Create A Website Having Azure Active Directory Authentication Using Visual Studio

Azure Active Directory (Azure AD) is Microsoft’s multi-tenant, cloud-based directory and identity management service. Azure AD combines core directory services, advanced identity governance, and application access management. Azure AD also offers a rich, standards-based platform that enables developers to deliver access control to their applications, based on centralized policy and rules.

If you are an Office 365, Azure or Dynamics CRM Online customer, you might not realize that you are already using Azure AD. Every Office 365, Azure and Dynamics CRM tenant is actually already an Azure AD tenant. Whenever you want you can start using that tenant to manage access to thousands of other cloud applications Azure AD integrates with!

Azure Active Directory

Prerequisite

  1. VS2015 or VS2017 should have installed in your machine
  2. Microsoft Azure account – if you don’t have azure account, sign on for free

Let’s quickly create a website having Azure Active Directory authentication using Visual Studio.

Step 1

Visual Studio >> New Project >> Web >> Select Web Application – give it some name and then press Ok.

Azure Active Directory

Step 2

Now, Choose template and then click on Change Authentication

Azure Active Directory 

Step 3

Select Work or School Accounts then select Cloud – Single Organization in the drop-down.

Now for the domain, we have to log into Azure account and then available domains will appear in the drop-down – Select the domain and then press OK.

Azure Active Directory

Step 4

We can see our domain information below. Now, Select OK.

Azure Active Directory 

Step 5

We can see our demo application in Solution Explorer, there’s a file named “appsettings.json” -  has all the authentication related information in it.

Azure Active Directory 

appsettings.json

Azure Active Directory

Step 6

Run Application – it will land into Microsoft sign in page.

Azure Active Directory 

Wow, we have logged into our application through AD authentication!!

Azure Active Directory

In just 6 steps, we have created Azure Active Directory enabled website – Visual Studio made it so simple to use Azure services.

References

  • https://docs.microsoft.com/en-us/azure/active-directory/active-directory-whatis            
  • https://channel9.msdn.com/Series/Windows-Azure-Active-Directory/Windows-Azure-Active-Directory-Cartoon


Similar Articles