Weird issues trying to implement Azure AD authorization in MVC 4 app.

So I've created this little url shortener app based on this post;

once I got that all running locally, I started migrating it towards Azure. I updated sql strings to a Azure SQL DB, I published it to a azurewebsite and all running fine so far.

So I thought, hey, why not add Azure AD authorization to a few of the actions on my homecontroller.

 [Authorize] [HttpGet] public ActionResult New(string shorturl, string n) { ... } 

Then I added the Azure Active Directory through Visual Studios "Add Connected Service" feature under Project in VS2015. It retrieved and installed all the required nuget packages and added the Authorize flare on the entire controller. I removed that so I could have anonymous access to the index, but authorized access to create new short-urls.

The problem I have now is that accessing leads to Azure AD SSO then that redirects back to and then that goes back to Azure AD ad-infinitum…

What do I need to do to make it stop looping?

Edit: I can add that the authentication is going through correctly, because it's adding a new tokencache entry in the tokencache table for each iteration over AzureAD

by AlwaysAppropriate via /r/csharp

Leave a Reply