Add Microsoft Entra ID authentication (Members)
Learn how to use Microsoft Entra ID (Azure Active Directory) credentials to login to Umbraco as a member.
This tutorial takes you through configuring Microsoft Entra ID (Azure Active Directory/Azure AD) for the member login on your Umbraco CMS website.
Entra ID conflicts with Umbraco ID which is the main authentication method used on all Umbraco Cloud projects.
Due to this, we highly recommend not using Azure AD for backoffice authentication on your Umbraco Cloud projects.
It is still possible to use other External Login Providers like Google Auth and OpenIdConnect, with Umbraco Cloud.
Prerequisites
A project with a setup for Members.
Visual Studio, or another Integrated Development Environment (IDE).
Step 1: Configure Entra ID
Before your applications can interact with Entra ID, they must be registered with a tenant that you manage. This can be either an Entra ID (Azure AD) tenant, or an Entra ID B2C (Azure AD B2C) tenant. For more information on creating an Azure AD B2C tenant, see Microsoft's Tutorial: Create an Azure Active Directory B2C tenant.
Step 2: Install the NuGet package
You need to install the Microsoft.AspNetCore.Authentication.MicrosoftAccount
NuGet package. There are two approaches to installing the packages:
Use your favorite Integrated Development Environment (IDE) and open up the NuGet Package Manager to search and install the packages.
Use the command line to install the package.
Step 3: Implement the Entra ID Authentication
Create a new class for custom configuration options:
EntraIDB2CMembersExternalLoginProviderOptions.cs
.
Create a new static extension class called
MemberAuthenticationExtensions.cs
.
Ensure to replace YOURCLIENTID
and YOURCLIENTSECRET
in the code with the values from the Entra ID tenant. If Entra ID is configured to use accounts in the organizational directory only (single tenant registration), you must specify the Token and Authorization endpoint. For more information on the differences between single and multi tenant registration, refer to Microsoft's identity platform documentation.
Add the Members authentication configuration in the
Program.cs
file:
Are you building a package for Umbraco?
Then you will not have access to the Program.cs
file. Instead you need to create a composer in order to register your extension method.
Learn more about this in the Dependency Injection article.
Build the project.
Run the website.
![](https://docs.umbraco.com/~gitbook/image?url=https%3A%2F%2F3701346516-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FG1Byxw7XfiZAj8zDMCTD%252Fuploads%252Fgit-blob-cca354a8a01fc08adefbd6bf18a7133a7cb2d2ed%252FAD_Login_Members%2520%281%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6cb76e0&sv=1)
Last updated