Replies: 3 comments 3 replies
-
Hi @b3n899 I experience the same issue. |
Beta Was this translation helpful? Give feedback.
-
Hi @b3n899 , same problem here. I'm running a runbook in Azure Automation and connect to PnP using Managed Identity. Get-PnPTenantSite was working fine for me for a couple of weeks an today I also got "Attempted to perform an unauthorized operation." error. Did you find any solution? |
Beta Was this translation helpful? Give feedback.
-
It seems to be a general issue. I also get "Attempted to perform an unauthorized operation." with Get-PnPTenantSite or Get-PnPUserProfileProperty since May 19th. |
Beta Was this translation helpful? Give feedback.
-
Hello all,
I try to retrieve all my sharepoint sites with permissions from an azure automation account powershell script using managed identity.
If I'm running the command on a specific site it's working fine.
My managed identity has Microsoft Graph and Sharepoint online sites.fullcontrol.all permissions.
Here is the script that I'm trying to use:
#Parameters
$SiteURL = "https://mytenant-admin.sharepoint.com"
#Connect to SharePoint Online
Connect-PnPOnline -Url $SiteURL -ManagedIdentity
#Get all sites in the SharePoint tenant
$Sites = Get-PnPTenantSite
#Array to store site information
$SiteData = @()
#Loop through each site and extract information
ForEach ($Site in $Sites)
{
#Get the web
$Web = Get-PnPWeb -Identity $Site.Url -Includes RoleAssignments
}
#Export the mailbox and permission information to a CSV file
$SiteData | Export-Csv -Path "SPOlist.csv" -NoTypeInformation
#Disconnect from SharePoint Online
Disconnect-PnPOnline
In addition, If I simply run the command Get-PnPTenantSite it gives me the output and If I close the test pane and run the test again I get the "Attempted to perform an unauthorized operation" it looks like it can't handle multiple queries or something similar.
Thanks for your help
Beta Was this translation helpful? Give feedback.
All reactions