Sign in a user in an ASP.NET Web App with OpenID Connect and the Microsoft identity platform endpoint
- Select the Cloud Shell button on the menu bar at the upper right in the Azure portal.
- FTP and local Git can deploy to an Azure web app by using a deployment user. Once you configure your deployment user, you can use it for all your Azure deployments. Your account-level deployment username and password are different from your Azure subscription credentials.
To configure the deployment user, run the az webapp deployment user set command in Azure Cloud Shell. Replace <username> and <password> with a deployment user username and password.
az webapp deployment user set --user-name <username> --password <password>
- Create a resource group
az group create --name myResourceGroup --location "West Europe"
- Create an App Service plan
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --sku FREE
- Create a web app, replace
<app-name>
with your app name
az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name <app-name> --deployment-local-git
- Get deployment user details from
- Get Web App URL
- Now navigate to Azure AD > App Registration > New Registration
- Now enter the App Name and Web App URL which we captured in step 6 and click Register
- Once the App registration is completed, make a note of your
Application (client) ID
- Now under same page, go to Authenication option then select Token and access id check box to allow token exchange between our app and Azure AD
- Now open Cloud Shell once again and do a git clone of our openid sso app
git clone https://github.com/webmagicinformatica/AzureADSSOSampleApp.git
- Change directory to following:
cd /AzureADSSOSampleApp/AppModelv2-WebApp-OpenIDConnect-DotNet
- Here we need to edit web.config to update following information:
Application (client) ID
copied in step 10- Azure Web App
URL
copied in step 7vi Web.config
- Edit clientID with
Application (client) ID
copied in step 10 & redirectURI with Azure Web AppURL
copied in step 7
Save the change by clickESC
followed by:wq!
- Now you need to deploy this code to Web App
- Add change to local git repo
git add .
- Commit the changes
git commit -m "ready to deploy"
- Add remote origin, you will need deployment user and URL copied in step 6
git remote add azure <deploymentLocalGitUrl-from-create-step>
- Push the code
git push azure master
- Add change to local git repo
- Now test the application
- First create a username in Azure AD, if you are not sure how to do it please refer this link
- Launch Azure Web App URL
- Enter Azure AD user you just create it’s username & password
- Once you successfully logged in you will see