How to Test SharePoint API Access with Sites.Selected Permission
Question details
The user needs to verify and troubleshoot SharePoint API access using PowerShell because API requests are failing despite having the Sites.Selected application permission and specific site read access.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Testing API connectivity and verifying access to a specific SharePoint site via an Azure AD application.
- Observed behavior
- API requests fail with access errors even though Microsoft Graph Sites.Selected permission and read access were supposedly granted to the application.
Ensure you have the latest PnP PowerShell module installed on your system and that you possess SharePoint Administrator privileges to verify site-level permission grants.
Verify Site Permissions and Test Access via PnP PowerShell
Use PnP PowerShell to explicitly check if the Azure AD application has been granted the correct role on the specific SharePoint site, and then attempt a test connection.
The Sites.Selected permission requires a two-step configuration: granting the scope in Azure AD and explicitly granting access to the target SharePoint site via the Microsoft Graph API. Missing the second step is the most common reason for access failures.
Open PowerShell and run 'Connect-PnPOnline -Url https://yourtenant.sharepoint.com/sites/yoursite -Interactive' to authenticate as an administrator.
Execute 'Get-PnPAzureADAppSitePermission' to list all applications with access to this specific site. Verify that your Azure AD App ID is listed with the 'read' role.
If your app is not listed, use 'Grant-PnPAzureADAppSitePermission -AppId <Your-App-ID> -DisplayName "Your App Name" -Permissions Read' to assign the correct permissions.
Disconnect, then try to reconnect using your app credentials: 'Connect-PnPOnline -Url https://yourtenant.sharepoint.com/sites/yoursite -ClientId <App-ID> -ClientSecret <Secret>'. If successful, your Sites.Selected permission is working correctly.

Seek Advanced Diagnostics on Microsoft Q&A
If PowerShell verification shows correct permissions but API calls still fail, the issue may involve deeper tenant-level routing or conditional access policies.
Experience Lightweight and Compatible Document Management with WPS Office
While resolving complex SharePoint and Azure AD API configurations requires specific Microsoft administrative tools, managing your daily documents shouldn't be complicated. WPS Office provides a free, lightweight, and powerful alternative to Microsoft Office. It seamlessly opens Word, Excel, and PowerPoint files without the heavy overhead.
- 1. Download the installer: Visit the official WPS Office website and click the free download button.
- 2. Install the software: Run the lightweight installer and follow the on-screen prompts to set up the suite on your device.
- 3. Open your documents: Launch WPS Office and directly open your existing Microsoft Office files with perfect formatting preservation.

Frequently Asked Questions
Why does my API request return a 403 Forbidden error with Sites.Selected?
This typically occurs because the Azure AD app was granted the Sites.Selected scope, but explicit permissions (like Read or Write) were never assigned to the specific SharePoint site using the Graph API or PnP PowerShell.
Can I configure Sites.Selected permissions directly through the SharePoint web interface?
No. Currently, assigning permissions to specific sites for an application using the Sites.Selected scope can only be done programmatically via the Microsoft Graph API or by using PowerShell modules like PnP PowerShell.
What is the primary difference between Sites.Read.All and Sites.Selected?
Sites.Read.All grants the application read access to every single SharePoint site within the entire Microsoft 365 tenant. Sites.Selected provides no access by default until an administrator explicitly grants the application access to specific individual sites, providing a much higher level of security.




