rnstvrcstll
rnstvrcstll

Reputation: 91

Azure App registration add authorized client applications through powershell Azure CLI

How to add authroized client applications (in portal : app registration -> Expose API -> add Authorized client applications) during app registration using powershell Azure CLI.

Upvotes: 0

Views: 1795

Answers (1)

Ansuman Bal
Ansuman Bal

Reputation: 11451

There is no az command to directly add preauthorized clients to a app registration instead you will have to use Graph API (beta) to update the same from Graph Explorer or az rest command.

Get OauthPermissionId with az command :

az ad app show --id $appId --query "oauth2Permissions[].id"

I tested the same from Graph Explorer :

enter image description here

Ran Patch : https://graph.microsoft.com/beta/applications/<appObjectId>

With Request body as :

{
    "api": {
        "preAuthorizedApplications": [
            {
                "appId": "authorizedappClientID",
                "permissionIds": [
                    "oauth2PermissionId"
                ]
            }
        ]
    }
}

enter image description here

Output:

enter image description here

Reference for az rest can be fount in this SO thread answered by Joy Wang .

Upvotes: 1

Related Questions