Skip to content

Instantly share code, notes, and snippets.

@svarukala
Last active January 19, 2021 20:58
Show Gist options
  • Select an option

  • Save svarukala/50ac5f3bc82bd6cc0bd8b636af3724d0 to your computer and use it in GitHub Desktop.

Select an option

Save svarukala/50ac5f3bc82bd6cc0bd8b636af3724d0 to your computer and use it in GitHub Desktop.
By default PnP Management Shell and CLI for Microsoft 365 app doesn't have permissions to Common Data Service (or Dataverse)/Dynamics CRM. This script adds the permissions required to use with CDS/CRM.
#Az module to login. Use allow no subscriptions if there is no active azure subcription assocaited with your tenant
az login --allow-no-subscriptions
#This app id corresponds to PnP Management Shell that is also used for CLI for Microsoft 365
$PnPPowerShellAppId = "31359c7f-bd7e-475c-86db-fdb8c937548e"
#The guid 00000007-0000-0000-c000-000000000000 corresponds to Common Data Service/Dynamics CRM
az ad app permission grant --id $PnPPowerShellAppId --api 00000007-0000-0000-c000-000000000000 --scope user_impersonation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment