I'm facing a frustrating issue while trying to give an app permission to access a couple of SharePoint sites using PowerShell. I have an Azure App Registration that works great normally and has full control permissions for my SharePoint sites. I've logged into PnP PowerShell with this app registration, but when I try to use the Grant-PnPAzureADAppSitePermission cmdlet, I receive an error message saying 'Access denied'. The error reads:
{"error":{"code":"accessDenied","message":"Access denied","innerError":{"date":"2025-07-07T15:25:50","request-id":"d6e54492-2f8f-4a7c-bf53-a836a09c07f0","client-request-id":"d6e54492-2f8f-4a7c-bf53-a836a09c07f0"}}}
I've double-checked, and the PnP App registration has the Sites.FullControl.All permission. I'm not sure what else could be causing this issue. Can anyone help out?
1 Answer
Have you tried letting PnP PowerShell generate its own client? Sometimes that can bypass these access issues. Just a thought!
What do you mean by that? I haven’t done that before.