Search code examples
azureazure-active-directory

AAD application with 'Single Page Application' as platform PowerShell script


I need to create an azure active directory (AAD) application. Here is the command I use:

$uiApp = New-AzADApplication    -DisplayName $uiAppDisplayName `
                                            -AvailableToOtherTenants $false `
                                            -ReplyUrls $replyUrls `
                                            -RequiredResourceAccess $requiredResourceAccess

How do I update the script to create an application with 'Single Page Application' as platform?

enter image description here


Solution

  • To create an application with 'Single Page Application' as platform, you need to add -SPARedirectUri $uri to your existing script.

    I tried to reproduce the same in my environment and got below results:

    I used below command to create application with 'Single Page Application' as platform like this:

    Connect-AzAccount -tenant <tenantID>
    $uiAppDisplayName = "SriGraphApp"
    $uri = "http://localhost:3000"
    $uiApp = New-AzADApplication    -DisplayName $uiAppDisplayName `
                                    -AvailableToOtherTenants $false `
                                    -SPARedirectUri $uri 
    

    Response:

    enter image description here

    When I checked the same in Portal, SriGraphApp with 'Single Page Application' as platform created sucessfully as below:

    enter image description here