iTranslated by AI
Creating Azure AD Applications from the Command Line
Introduction
Until now, I have always created Azure AD applications via the Azure Portal, but since it is problematic if they are not codified during deployment, I have summarized the methods for doing so. There are several ways to achieve this, and I had some trouble, so I am documenting them here.
Comparison of modules
AzureAD module
You can use New-AzureADApplication to create applications.
After trying it out, I encountered the following issues:
- It is not compatible with PowerShell Core.
- The parameters are extremely complex.
Az module
You can use New-AzADApplication to create applications.
After trying it out, I encountered the following issues:
- There are few parameters that can be configured.
- For example, you cannot specify
oauth2AllowImplicitFlow.
- For example, you cannot specify
- You cannot omit
IdentifierUris.
Azure CLI
You can use az ad app create to create applications.
After trying it out, I encountered the following issues:
- The return value is difficult to handle.
- This becomes a problem when you need to use the Application ID to perform subsequent processes after creating the application.
- You cannot create applications with the same name.
- Information for an existing application with the same name is automatically overwritten.
Microsoft.Graph module
You can use New-MgApplication to create applications.
After trying it out, I encountered the following issues:
- The parameter format is slightly different from the manifest definition.
Conclusion
For now, the Microsoft.Graph module seems to be the best choice.
Discussion