I have a problem running functionality tests(SpecFlow with Nunit) on the pipeline, all my test requires Azure AD login in order to perfom any functionality, I have more than 40 tests of which all of them are running on my local pc via visual studio, but when i am running them on the build pipeline agent, only 4 out of 40+ test are passing, all the failing tests they seem to be failing at the Azure AD login Screen
Asked
Active
Viewed 364 times
0
-
How are you logging in to Azure AD locally? You may need to set up Azure AD login via Powershell, if this is a necessity for your application/organization. – ryanwebjackson Apr 12 '21 at 13:33
-
I am loggin in the same way, i go to my home url then it redirects to login.microsoft.com login, i enter the details using selenium, then after i am authenticated it the redirects me to the my home application. – XOLISANI NGCOBO Apr 12 '21 at 18:29
-
someone recommended that i login to azure azure AD via and API not via GUI, but i am unable to find a documentation about that. – XOLISANI NGCOBO Apr 12 '21 at 18:30
-
Yes, you should log in via the API. Something like this should help: https://learn.microsoft.com/en-us/powershell/azure/authenticate-azureps?view=azps-5.8.0 "Sign in with Azure PowerShell" – ryanwebjackson Apr 19 '21 at 21:47
1 Answers
1
functional Tests are failing to authenticate using Azure Active Directory on the build pipeline
You could use the Resource Owner Password Grant to authenticate Azure Active Directory, but this is not recommended for production usage in real UIs though.
Source refer: Unit Testing ASP.NET Core AAD Auth
Alternatively, you could also create your private agent:
And if you have UI test in your test, please make sure run your self-hosted agent as an interactive mode and a special configuration of the agents is required.

Leo Liu
- 71,098
- 10
- 114
- 135