Home > database >  Can't find Powershell command to grant admin consent
Can't find Powershell command to grant admin consent

Time:07-14

I have one Azure Ad app created via powershell.

I added permissions using Add-AzADAppPermission by following this document: Add-AzADAppPermission (Az.Resources) | Microsoft Docs Now I want to grant admin consent for the added permissions via powershell but I can't find any related command or any ms doc.

Is there any command that I can use to grant admin consent from powershell?

Can anyone please shed light on this?

CodePudding user response:

AFAIK, currently PowerShell don't have any command for granting admin consent.

Alternatively, you can make use of Azure CLI/Azure Portal to achieve your scenario as suggested by Joy Wang in this similar SO Thread.

I tried to reproduce the same in my environment like below:

I assigned the API permissions that need admin consent:

enter image description here

To grant the admin consent, execute the below command:

az login
az ad app permission admin-consent --id <application-id>

enter image description here

After executing the above command, admin consent for the API permissions granted successfully like below:

enter image description here

Reference:

az ad app permission | Microsoft Docs

  • Related