[BUG] Get-PnPGroup and Get-PnPGroupMember in Azure Automation runbook with System-Assigned Managed Identity throw a Not Authorized error #4781
-
I have an Azure automation runbook using a system-assigned Managed Identity. When the runbook executes a Get-PnPGroup or Get-PnPGroupMember cmdlet, a "401 unauthorized" error is returned. BTW, the same issue occurs with Get-PnPSiteCollectionAdmin. Expected behavior"Get-PnPGroup" returns a list of the SharePoint groups in the connected site collection. Actual behaviorResponse received: Steps to reproduce behavior
Sites.Read.All (SharePointOnline)
$siteUrl = "... url here ..." What is the version of the Cmdlet module you are running2.12.0 Which operating system/environment are you running PnP PowerShell on?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is a server side error due to insufficient permissions, moving it to discussion. |
Beta Was this translation helpful? Give feedback.
-
Hi Gautam - thanks for the response! I can confirm that changing the permission level to Sites.FullControl.All does resolve the issue and the group membership can be read. |
Beta Was this translation helpful? Give feedback.
This is a server side error due to insufficient permissions, moving it to discussion.
Would recommend changing permissions to Sites.FullCntrol (SharePoint) or Sites.Manage (SharePoint) and check