Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arjancornelissen/aa2b4aced1d55aecc7dd19981606afa0 to your computer and use it in GitHub Desktop.
Save arjancornelissen/aa2b4aced1d55aecc7dd19981606afa0 to your computer and use it in GitHub Desktop.
Connect to SharePoint Online in Azure Automation with Run As account
$servicePrincipalConnection=Get-AutomationConnection -Name "AzureRunAsConnection"
$appsecret = Get-AutomationVariable -Name "SPAppSecret"
Connect-PnPOnline -AppId $servicePrincipalConnection.ApplicationId -AppSecret $appsecret -Url "https://<tenant>-admin.sharepoint.com"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment