Microsoft Entra External ID Integration with ASP.NET Core MVC Web application

Introduction:

As organizations increasingly extend their digital services to partners, customers, and third-party developers, managing external identities becomes a strategic imperative. Microsoft Entra External ID is designed to streamline this challenge by offering a scalable, secure, and standards-based identity solution that integrates seamlessly with modern application architectures. In this article, I will guide you through integrating Microsoft Entra External ID with an ASP.NET Core MVC application, demonstrating how to configure authentication, handle user claims, and enforce authorization for external users. Whether you’re a software architect planning a multi-tenant SaaS platform or a developer aiming to enhance security and usability, this guide bridges the gap between identity management and practical implementation.

Get started with Integration:

Step 1: Open Visual Studio 2022, click on Create a New Project, select ASP.NET Core Web App (MVC) Template, provide a project name, and click Next to get a wizard below.

Configure MS Identity Platform Auth method
  • Framework – Anything above .NET 8.0
  • Authentication type – Microsoft identity platform

Step 2: In the service dependencies wizard, add the dotnet misidentify tool to add a Microsoft identity platform, and click Next.

Add msidentity tool

Step 3: Select the tenant and click on Create new to register a new External Entra ID application, and provide a Display name as shown in the figure below.

Tenant Configuration

Step 4: Clicking on Register will register the application in Microsoft Entra External ID. I won’t add Microsoft Graph or any other API for this demo.

Add Graph API wizard

Finally, click next, it will scaffold all required NuGet packages and changes in the Program.cs, appsettings.json

Step 5: In this step, switch to entra.microsoft.com and ensure you are in the External ID tenant, go to the user flow. Please refer to my previous article to check how to create a user flow.  Select the user flow and click on Application to link our application to the user flow, as shown in the figures below.

Entra ID portal
Add application

Step 6: Finally, run the application, it will prompt the MS Entra External ID User flow sign-in screen, enter your social account credentials, after successful authentication, it will launch the Home screen as shown in the figures below

MS Entra External ID sign in screen
ASP.NET Core web application

Summary:

This article provides a step-by-step guide to integrating Microsoft Entra External ID with an ASP.NET Core MVC application. It covers key concepts such as configuring authentication for external identities, handling user claims, and implementing secure access controls. By leveraging Microsoft’s identity platform, developers can enhance application security and deliver a seamless user experience for external collaborators, including customers, partners, and vendors. The walkthrough supports technical implementation and strategic decision-making in identity management.

Gowtham K

Gowtham K has been awarded as MVP(Most Valuable Professional) for 9 times by Microsoft for his exceptional contribution in Microsoft technologies under the category “Developer Technologies & Security” . He has more than 12 years of experience on Microsoft technologies such as C#, ASP.NET MVC, ASP.NET WEB API, ASP.NET Core, MS SQL Server, Azure, Microsoft Entra ID, Azure AD B2C and other technologies such as JavaScript, jQuery, HTML and CSS .He is also a blogger and author of articles on various technologies. He is also a speaker and delivered talk on various technologies like ASP.NET MVC, Azure and Azure DevOps in the public events.

Leave a Reply

Your email address will not be published. Required fields are marked *