A code sample accompanying an article Creating a multi-tenant application which supports B2B users on my blog.
- Create an Azure AD application in the Portal.
- Configure application's permissions to have access to Windows Azure Service Management API and also Microsoft Graph (add permissions to sign-in the user and read user's profile, read basic profiles of users and also access directory as currently signed in user)
- Get the application's client id, client secret and configure the reply url to http://localhost:5000/signin-oidc
- Replace the client id in the appsettings.json and place the client secret into user secrets or environmental variables if deploying to Azure.