Hi @Edward Croxton ,
Welcome to Q&A forum!
It looks like the account doesn't have enough permission.
Here are a few steps you can try to resolve this error:
Check Permissions: Ensure that the account you're using has the necessary permissions. For Get-PnPTenantSite
, you typically need SharePoint Online Administrator or Global Administrator permissions.
- Update PnP PowerShell Module: Make sure you're using the latest version of the PnP PowerShell module. You can update it using:
Connect with Correct Permissions: When connecting to SharePoint Online, ensure you're using the correct permissions. For example:Update-Module -Name PnP.PowerShell
Connect-PnPOnline -Url "https://yourtenant-admin.sharepoint.com" -ClientId "your-client-id" -ClientSecret "your-client-secret"
- Use Managed Identity: If you're using Azure Automation or a similar service, ensure that the managed identity has the necessary permissions. You might need to grant Sites.FullControl.All permissions instead of more limited ones
- Check for Known Issues: Sometimes, there might be known issues or bugs with specific versions of the PnP PowerShell module. Checking the PnP PowerShell GitHub repository for similar issues can be helpful.
If these steps don't resolve the issue, it may to be caused by PnP PowerShell. According to my search, there are many users who have encountered this problem. As currently we only support general issues of SharePoint, so we recommend you submit a new issue on github. There are concentrated discussions on issues related to PnP PowerShell.
Good day!
If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.