Skip to content

Instantly share code, notes, and snippets.

@AlexanderHolmeset
Created March 14, 2023 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexanderHolmeset/e7f6f1a8c0ac9968c1ea9183d13f4f83 to your computer and use it in GitHub Desktop.
Save AlexanderHolmeset/e7f6f1a8c0ac9968c1ea9183d13f4f83 to your computer and use it in GitHub Desktop.
#Connect using your tenants SharePoint admin url.
Connect-PnPOnline -Url M365x28850929-admin.sharepoint.com -Interactive
#Enter the App ID you coped from the Enterprise Application.
$ManagedIdentityID = "4bf49741-7819-47f1-9e30-c36ef6b9d1aa"
Add-PnPAzureADServicePrincipalAppRole -Principal $ManagedIdentityID -AppRole "Sites.ReadWrite.All" -BuiltInType MicrosoftGraph
Add-PnPAzureADServicePrincipalAppRole -Principal $ManagedIdentityID -AppRole "Sites.FullControl.All" -BuiltInType MicrosoftGraph
Add-PnPAzureADServicePrincipalAppRole -Principal $ManagedIdentityID -AppRole "Sites.FullControl.All" -BuiltInType SharePointOnline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment