Skip to content
  • English Deutsch

benjamin-abt.com

Performance is a feature | Cloud - AI - Azure - .NET - Sustainability

  • Home
  • Blog
  • Portfolio
    • Overview
    • Workshops & Training
    • Publications
  • Contact
  • Home
  • Blog

Create Azure Active Directory App Registration with Azure CLI

Create Azure Active Directory App Registration with Azure CLI
March 9, 2022 2 min read BEN ABT
Azure Azure Cli Azure Active Directory

This article was written in 2022. Versions, tools and recommendations may have changed since then. Newer posts are collected under Azure.

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:

Shell
winget install -e --id Microsoft.AzureCLI

Using Chocolatey:

Shell
choco install azure-cli

Manual Install: Azure CLI Docs

Login

Login into your Azure Account from CLI:

Shell
az login

or use device code login to use a custom browser window (e.g. multi account feature of your browser):

Shell
az login --use-device-code

Select a subscription

Shell
az 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

PowerShell
 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

PowerShell
 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

  • az ad app
  • az ad app create
  • az ad app update
  • az rest

Conclusion:

It is still very simple and fast to create Azure AD App Registrations, however it is just not well documented.

Related articles

Automatic TTL in Azure Cosmos DB with .NET

Aug 17, 2026 - 17 min read

Automatic TTL in Azure Cosmos DB with .NET

Temporary data is easy to create and surprisingly difficult to remove reliably. Sessions, idempotency keys, import buffers, transient …

Run Hono on Azure Static Web Apps: managed Functions APIs for static frontends

Jul 19, 2026 - 8 min read

Run Hono on Azure Static Web Apps: managed Functions APIs for static frontends

Azure Static Web Apps is primarily a host for static frontend assets, but it can also deploy a small HTTP API alongside the frontend. That …

Run Hono on Azure: Container Apps, Functions, App Service and AKS compared

Jul 12, 2026 - 14 min read

Run Hono on Azure: Container Apps, Functions, App Service and AKS compared

Hono is often associated with Cloudflare Workers and for good reason. Its small routing model, Web Standard API surface and direct fetch …


BEN ABT

BEN ABT

Ben is Chief Engineering Officer and Principal Software Engineer at Medialesson.de, with a strong focus on .NET and Microsoft Azure. In his professional role, he designs and builds highly scalable platforms for hybrid and cloud-based scenarios. He also advises companies and C-levels on migrating to the sovereign cloud.

He runs myCSharp.de, the largest and most active German-speaking C# community forum, actively contributes to both his own and external open-source projects and regularly shares his knowledge through his blog, at community events, conferences and as a writer for technical magazines.

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.

New Platforms

Modernization

Training & Consulting

Contact Me
X Facebook LinkedIn WhatsApp
Back Next Blog Post

Open for work!

Contact Me
BEN ABT BEN ABT Software Engineer · Microsoft MVP Passionate about .NET, Azure, performance optimization and sustainable software engineering.

Medialesson GmbH Logo

Microsoft MVP Logo

Recent posts

View all
Stop Using nginx as Your Default Static File Server in Docker

Stop Using nginx as Your Default Static File Server in …

Oct 24, 2026
Containerizing .NET in 2026 Without a Dockerfile

Containerizing .NET in 2026 Without a Dockerfile

Oct 20, 2026
Problem Details in ASP.NET Core and .NET 11

Problem Details in ASP.NET Core and .NET 11

Oct 5, 2026
Resilience in .NET with Microsoft.Extensions.Resilience

Resilience in .NET with Microsoft.Extensions.Resilience

Sep 21, 2026
What Matters in ASP.NET Core 11

What Matters in ASP.NET Core 11

Sep 14, 2026

Tags

.NET (192) Csharp (96) ASP.NET Core (48) Azure (41) DevOps (17) Docker (14) Microsoft (14) EF Core (11) Microsoft MVP (11) AI (10) GitHub (10) GitHub Copilot (10) ASP.NET (9) Security (9) Synology (9) Architecture (8) Raspberry (8) Azure Functions (7) Cloudflare (7) Bicep (6)
benjamin-abt.com

About BEN

Benjamin Abt is a Software Engineer, Platform Architect and Microsoft MVP specializing in .NET, Azure, cloud architecture, performance optimization and sustainable software development.

Connect

  • Follow me on GitHub
  • Follow me on LinkedIn
  • Follow me on Mastodon
  • Microsoft MVP profile
  • Follow SchwabenCode on GitHub
  • Follow me on X

Quick Links

  • Portfolio
  • Blog
  • Workshops & Training
  • Publications
  • Get in Touch
  • Sitemap
Open for Work

© Copyright Benjamin Abt & SchwabenCode | 2011 - 2026

Content licensed under CC BY 4.0 unless otherwise noted.

  • Impressum
  • Privacy
  • Contact