Unit testing APIs protected using Azure AD and Microsoft.Identity.Web

Sahil Malik
Winsmarts.com
Published in
4 min readMar 29, 2021

--

This is a question I get a lot, How do I write unit tests for APIs protected by Azure AD?

Well, the answer is simple — like you’d write unit tests for any other API.

Let me explain. For this article, I’ll use the sample apps/apis Microsoft has published here. I feel that is an exemplary API that demonstrates the usage of Microsoft.Identity.Web and shows how Microsoft recommends you secure your APIs.

--

--