Azure Active Directory Authentication Sample for DotVVM
Sign in to the Azure Portal and open (or create) your Azure Active Directory resource.
Open the Properties tab and copy the Directory ID value. Paste it in the
TenantIdapplication setting in the
web.configfile in OWIN or
appsettings.jsonin ASP.NET Core.
Open the App registrations tab and open (or create) the app registration.
Copy the Application ID value and paste it in the
ClientIdapplication setting in the
Make sure that the URL on which the web app is running, is listed in the Home Page field or in the Reply URLs section. The URL must match including the HTTP/HTTPS and port.
In ASP.NET Core version, set the
PostLogoutRedirectUriapplication setting to the application root URL.
Now the application should work with all accounts from the directory.
If you want to make the application multi-tenant (to allow the users to sign in even if they are from a different Azure Active Directory tenant), you need to make these changes:
In the Properties tab of the App Registration, switch the Multi-tenanted field to Yes.
appsettings.json, change the
TenantIdto the value