powershellazurepowershell-2.0azure-active-directoryazure-ad-powershell-v2

Creation of new AzureAD application with powershell


I'm trying to create a new AzureAD application by using the Azure Active Directory Powershell 2.0 module, however after calling the New- AzureADApplication I get a HTTP Bad requset with the following error.

+ New-AzureADApplication -DisplayName "Umbraco-domea" -IdentifierUris $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-AzureADApplication], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.NewApplication

I found the following github issue with a bit of googling, however even by including the -IdentifierUris in my cmdlet call I still get the error.

New-AzureADApplication -DisplayName $displayName -IdentifierUris $URIs -GroupMembershipClaims "SecurityGroup" -ReplyUrls @($Live",$Dev,"http://localhost:4198/")

Solution

  • The following script works for me, maybe you could test.

    $displayName="shuitest"
    $URIs="http://mynewapp.contoso.com"
    $Live="https://localhost:8080"
    $Dev="https://localhost:8081"
    New-AzureADApplication -DisplayName $displayName -IdentifierUris $URIs -GroupMembershipClaims "SecurityGroup" -ReplyUrls @($Live,$Dev,"http://localhost:4198/")
    

    If you also get same error log, begin your script add $DebugPreference="Continue" to produce additional debugging information.