I have a MVC Web App in Azure with AD authentication. When I run the website locally, it signs in and out just fine, using Azure AD. But the signout on my deployed Azure w
I have figured out what the issue is. The out-of-the-box MVC Web App in Azure with AD authentication that I created uses AspNet cookies. Which the GetOwinContext().Authentication.SignOut clears. And this was working fine for me on localhost. The issue arose when I deployed it to Azure and then configured the website in the new Azure portal, to use AD authentication. It appears to convert the website into a Azure App Service. Now the cookies are AppServiceAuthSession cookies - no longer the AspNet cookies. Thus, the logout no longer works.
Here is the response from the Microsoft rep that I worked with on this:
I did some more research around this, and spoke with both the Azure AD teams and Azure Websites teams. Apparently that new portal setting takes care of all the auth components for you. So really you have two approaches to setting up Auzre AD auth against your website. You can do it through code like you see in that Out of the Box ASP.NET MVC project, where you have access to the AccountController.
Or the other approach is to just let Azure handle it for you by enabling that setting in the new Azure portal. When you let the new Azure portal do it then it uses a different session cookie name and different logout logic. It appears that automatic auth doesn’t play well with the coded logout logic.
So your workaround is correct. You basically have two workarounds here to get an MVC app up and running that supports Azure AD authentication: