Example of how to set up an ASP.NET MVC 5 website with Azure AD authentication
JavaScript C# CSS ASP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Azure AD MVC Example

Example of how to add Microsoft Azure Active Directory to an existing ASP.NET MVC 5 website.

See the blog series for explanations.

For a detailed look at the step-by-step process that was followed to set up everything see the commit list.

To visit the test site to see it in action check out https://azureadmvcexample.azurewebsites.net.


Infrastructure Setup

  • Azure Active Directory tenant at azureadmvcexample.onmicrosoft.com with GUID a83a168d-d1ad-4bde-9b0a-ed570162e695
  • Application with realm / audience URL http://localhost:34999 and client ID 4e84d32e-7c1d-420b-88ac-e5cb655d292f (matches the IIS Express setting for the local site)
  • Application with realm / audience URL https://azureadmvcexample.azurewebsites.net and client ID e4a511a6-f9a2-408c-a4a1-c687bc93e297
  • The following test users:
    • username1@azureadmvcexample.onmicrosoft.com with password P@ssword2, which is a member of Group 1 and Group 2
    • username2@azureadmvcexample.onmicrosoft.com with password P@ssword2, which is a member of Group 2 and Group 3