
There are now an insane number of ways to register applications in Azure Active Directory - but many ways are no longer supported or have been discontinued, for example the old Azure PowerShell tools.
However, new tools - for example PowerShell Az - do not support all features, are not well documented or do not behave as expected. In addition, for months there has been a bug in PowerShell that makes the tooling installation take up to 60 minutes! Powershell Gallery slowness: Install-Module -Name Az takes 60 minutes instead of 3
However, one way is still stable and working: the Azure CLI.
Install Azure CLI
Using WinGet:
1winget install -e --id Microsoft.AzureCLI
Using Chocolatey:
1choco install azure-cli
Manual Install: Azure CLI Docs
Login
Login into your Azure Account from CLI:
1az login
or use device code login to use a custom browser window (e.g. multi account feature of your browser):
1az login --use-device-code
Select a subscription
1az account set --subscription $subscriptionId
Create Azure App Registration
When creating the app, it is important to consider what type of app is desired. By default, certain parameters always refer to a web app, e.g. Reply URLs. If a SPA is desired, an update must also take place after the creation!
Create WebApp
1$uri = "https://ba-sample-webapp.azurewebsites.net/"
2$appName = "Benjamin Abt Sample WebApp"
3$appHomepage = "https://ba-sample-webapp.azurewebsites.net/"
4$appReplyUrls = @("https://ba-sample-webapp.azurewebsites.net/",
5 "https://ba-sample-webapp.azurewebsites.net/logout/")
6
7Write-Host "Web App Creating.."
8$app = az ad app create --display-name $appName `
9 --homepage $appHomepage `
10 --reply-urls $appReplyUrls `
11 | ConvertFrom-Json
12Write-Host "Web App $($app.appId) Created."
Create SPA App
1$uri = "https://ba-sample-webapp.azurewebsites.net/"
2$appName = "Benjamin Abt Sample WebApp"
3$appHomepage = "https://ba-sample-webapp.azurewebsites.net/"
4$appReplyUrls = @("https://ba-sample-webapp.azurewebsites.net/",
5 "https://ba-sample-webapp.azurewebsites.net/logout/")
6
7Write-Host "SPA App Creating.."
8$app = az ad app create --display-name $appName `
9 --homepage $appHomepage `
10 | ConvertFrom-Json
11Write-Host "SPA App $($app.appId) Created."
12
13Write-Host "SPA App Updating.."
14# there is no CLI support to add reply urls to a SPA, so we have to patch manually via az rest
15$appPatchUri = "https://graph.microsoft.com/v1.0/applications/{0}" -f $app.objectId
16$appReplyUrlsString = "'{0}'" -f ($appReplyUrls -join "','")
17$appPatchBody = "{spa:{redirectUris:[$appReplyUrlsString]}}"
18az rest --method PATCH --uri $appPatchUri --headers 'Content-Type=application/json' `
19 --body $appPatchBody
20Write-Host "SPA App Updated."
Docs
Conclusion:
It is still very simple and fast to create Azure AD App Registrations, however it is just not well documented.
Related articles

Feb 11, 2022 - 2 min read
Serve a SPA like Angular or React on Azure App Service for Linux
In many scenarios it can make sense to host single page applications via an Azure Web App, for example if you have many small applications - …

Jan 22, 2022 - 1 min read
Validate Bicep config during CI/CD with Azure DevOps
Bicep scripts are ideally part of the source code and can also be used as such in the build process of the application.

Dec 08, 2021 - 2 min read
What's Bicep on Azure and why you should use it?
To generate resources automatically in Azure, you could either do Azure Resource Manager templates, which no one really wanted to do because …
Let's Work Together
Looking for an experienced Platform Architect or Engineer for your next project? Whether it's cloud migration, platform modernization or building new solutions from scratch - I'm here to help you succeed.
