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: Quickstart: Use your Azure subscription to create an external tenant.
Follow these steps to register your web application with your Entra tenant and configure it for member sign-in:
Follow the instructions in Register an application in Microsoft Entra ID using the Microsoft Entra admin center.
On the App Registrations screen, copy the Application (Client) ID value. You will need this in your code later.
Click Add a certificate or secret.

Add a new client secret and copy the generated Value. You will use this in your code as well.
Return to the Overview screen and click Add a Redirect URI.
Add full URLs for all of your applicable environments (local, dev, live, etc.) with the path
/umbraco-b2c-members-signinappended. For example,https://mysite.com/umbraco-b2c-members-signin.
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.
The Client Secret value will expire and must be regenerated in the Entra admin center. Use configurable secret storage to provide the value to your code, rather than hard-coding it.
Add the Members authentication configuration in the
Program.csfile:
Build the project.
Run the website.

Last updated