Aziz Alzayed
Aziz Alzayed

Reputation: 236

Testing Azure Active Directory security locally?

this question has been asked before about 2 years : Link

is there any way or new feature to mock or test the AAD?

e.g. log in by specific email.

Upvotes: 0

Views: 736

Answers (1)

juunas
juunas

Reputation: 58723

You can test APIs protected by Azure AD by getting tokens as apps and users. I wrote a whole article on the topic: https://joonasw.net/view/testing-azure-ad-protected-apis-part-3-automated-integration-tests.

Essentially you can use Client credentials flow to get application tokens and ROPC flow to get user tokens. Then you can test the API with those.

As for UI applications, there is no good approach that I am aware of. You can try to automate logins, but it's a bit likely that AAD will think it's not a human and starts blocking logins. The AAD team has said on multiple occasions that trying to automate those logins isn't something you should do.

You'd need an entirely different identity provider used in tests to allow UI testing properly.

Upvotes: 2

Related Questions