DEV Community

John Peters
John Peters

Posted on

Azure AD / .NET Core 3.1 / Web API

If you are struggling with .NET Core 3.1 and Azure AD hookup (Cloud Authentication) in a Web API solution, here's the answer.

Don't feel bad, because as of 3/10/2020 there are no examples and the configuration services tool is not updated yet (so don't use it to replace the Startup.cs file). Then keep in mind that anything Security related is a career unto itself.

Note
Core 3.1 no longer uses Services configurations of type ADDMVC or MVC routing. You must use the new ADDENDPOINTS construct.

The Web API templates do not yet use the proper startup templates. You must manually change the startup configs.

You must add this assembly to the solution

Microsoft.AspNetCore.Authentication.AzureAD.UI;

Just look for Azure AD in Nuget.

If you use the built in "Connected Services helper" do not click yes to "want to update startup.cs". Just follow the article above.

Finally, good luck if you can't get it to work because debugging these types of issues is a long painful slow endeavor. After all, it's all secret..

Top comments (0)