Hello @Darshan,
Thank you for posting your query on Microsoft Q&A.
Configuring Single Sign-On (SSO) for multiple organizations using Microsoft Entra ID (Formerly named as Azure AD) in an ASP.NET MVC 5 application involves several steps. Below is a high-level guide to help you set this up:
Steps to Configure:
1. Register Your Application in Entra ID
You need to register your application in each Entra ID tenant.
- Register the Application in Azure AD:
- Go to the Azure portal.
- Navigate to
Microsoft Entra ID
>App registrations
. - Click on
New registration
. - Fill in the required details (Name, Redirect URI, etc.).
- Note down the
Application (client) ID
andDirectory (tenant) ID
.
- Configure Authentication:
- Under
Authentication
, add a platform configuration forWeb
. - Set the Redirect URI to
https://yourapp.com/signin-oidc
(replace with your actual URL). - Enable
ID tokens
.
- Under
- Create Client Secret:
- Under
Certificates & secrets
, create a new client secret. - Note down the secret value.
- Under
Repeat the above steps for each organization's Azure AD tenant.
2. Configure Your ASP.NET MVC 5 Application
You need to configure your application to use OpenID Connect for authentication.
- Install Required NuGet Packages:
Install-Package Microsoft.Owin.Security.OpenIdConnect Install-Package Microsoft.Owin.Security.Cookies Install-Package Microsoft.Owin.Host.SystemWeb
- Update Startup.cs: Configure the OWIN middleware to use OpenID Connect.
- Handle Authentication Requests: Update your controllers to handle authentication requests.
- Update Web.config: Ensure your
web.config
has the necessary settings for OWIN.
Testing: Navigate to the sign-in URL for each organization and ensure the SSO process works as expected.
By following these steps, you should be able to configure SSO for multiple organizations using Microsoft Entra ID in your ASP.NET MVC 5 application.
Please refer the below documents for code sample.
- ASP.NET web app
- Register an application with the Microsoft identity platform
- Prepare an application for authentication
- Add sign in to an application
- Sign-in using multiple clients or tenants in ASP.NET Core and Azure AD
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.
Thanks,
Raja Pothuraju.