[BUG] - SharePoint Delegated Sites.Selected
Reporting an Issue or Missing Feature
Cannot use SharePoint Delegated Sites.Selected permission
Expected behavior
When executing the following:
connect-pnpOnline -Url "https://[tenant].sharepoint.com/sites/site1" -Interactive -ClientId "[app clientid]" Get-PnPSite
I get information about the current site.
App I'm using has Sites.Selected delegated SharePoint permission and was created following: Manually create an app registration for interactive login
Actual behavior
Get-PnPSite returns:
Get-PnPSite: Attempted to perform an unauthorized operation.
Steps to reproduce behavior
- Create an app registration following: Manually create an app registration for interactive login
- Grant necessary permission using:
Grant-PnPAzureADAppSitePermission -AppId "[app clientid]" -DisplayName "[app name]" -Permissions FullControl -Site "https://[tenant].sharepoint.com/sites/site1"
What is the version of the Cmdlet module you are running?
3.1.195
Which operating system/environment are you running PnP PowerShell on?
- [x] Windows
- [ ] Linux
- [ ] MacOS
- [ ] Azure Cloud Shell
- [ ] Azure Functions
- [ ] Other : please specify
@a1mery: Thanks for raising the bug. Try adding MS Graph Sites.Selected to see if it makes any difference.
@a1mery - if you access it via the browser, are you able to view the site ? Delegated works with your current permissions
@reshmee011 @gautamdsheth thanks for your replies ☺️ I've added the MS Graph Sites.Selected and same issue occurs 😔 I'm admin of the SharePoint site
Alas I can reproduce the issue:<, Did you try the same with the version 3.1.0?
Yes, I tried using version 3.1.0. That's actually where I first encountered the issue, but I updated to the latest version to make sure it hadn’t already been resolved 😊
It feels to me an issue with MS back end, by any chance have you got cli for m365 and try the same steps, connect using the client id and get the site details or using the ms graph powershell. If you can reproduce the issue with ms graph powershell, potentially you could raise a MS issue.
Same issue for me on the Mac and Debian 13 Linux terminals.
Granting Sites.Selected write permissions to App ID: 997644XX-XXXX-XXXX-XXXX Error: {"error":{"code":"accessDenied","message":"Access denied","innerError":{"date":"2025-11-16T08:30:50","request-id":"c4980bf0-7ee5-4ed8-96f1-12e1430acbe3","client-request-id":"c4980bf0-7ee5-4ed8-96f1-12e1430acbe3"}}}
ModuleType Version PreRelease Name ExportedCommands
Manifest 3.1.0 PnP.PowerShell
In order to use Sites.Selected, you have to provide permissions to the site FOR the app.
https://pnp.github.io/powershell/cmdlets/Grant-PnPAzureADAppSitePermission.html
_Connect-PnPOnline -Url "https://yourtenant-admin.sharepoint.com" -Interactive
Grant the app access to a specific site
Grant-PnPAzureADAppSitePermission -AppId "YOUR-APP-ID" -DisplayName "Your App Name"
-Site "https://yourtenant.sharepoint.com/sites/yoursite" `
-Permissions Write # or Read, FullControl_