Bypassing 2 Factor authentication for automating tests in Azure portal

168 views
Skip to first unread message

Aniket Dasgupta

unread,
Oct 10, 2023, 10:48:45 AM10/10/23
to Selenium Users
HI Team,
A very good morning ! I am working for ASDA UK as an automation architect for the project. We have been able to achieve automation in Azure portal using Rest Assured and backend API for log analytics workspace.

A particular situation in which we encountered a problem while using selenium for automating inside the azure portal , which unfortunately could not be automated using backend API. Whenever chromedriver opens a new session of the portal it asks for a 2 factor authentication which unfortunately could not be bypassed . As a result we raised a request with our cloud and support team. 

They helped us in raising a service principal unfortunately the credentials which were provided could not be utilized in a selenium script, I was wondering whether there is a method to utilize the same in some way or the other.

It would be really helpful if I can get some views on the same

Krishnan Mahadevan

unread,
Oct 10, 2023, 12:36:31 PM10/10/23
to seleniu...@googlegroups.com

Aniket,

 

Since I don’t have a sample webapp at my disposal that demonstrates what your setup is doing, I would suggest that you go through the below and see which of them helps

 

  1. https://www.selenium.dev/blog/2021/a-tour-of-4-authentication/ (Only support right now is username+password based)
  2. Trace through this implementation to see if you can customize it for other types of authentication. https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/chromium/ChromiumDriver.java#L211
  3. The CDP protocol around Fetch domain https://chromedevtools.github.io/devtools-protocol/tot/Fetch/

 

You may have to combine learnings from (2) and (3) to see what would work for your specific case, if (1) doesn’t help you.

 

Hope that helps!

 

 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribblings @ https://rationaleemotions.com/

 

 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/cdd39527-4a19-489e-b506-47a1e7d63952n%40googlegroups.com.

Aniket Dasgupta

unread,
Oct 12, 2023, 8:18:42 AM10/12/23
to Selenium Users
Thanks Krishnan,

I would explore the below options which you have mentioned. I would also try to explore using rest assured is there a way to call the backend API and bypass this and then use selenium webdriver.

Regards,
Aniket

Reply all
Reply to author
Forward
0 new messages