Grant-PnPAzureADAppSitePermission does not work when setting read permission to personal site

Melvin 80 Reputation points
2025-12-16T23:19:20.2366667+00:00

Hi,

Is it expected that the PowerShell command Grant-PnPAzureADAppSitePermission does not work when granting read access to a personal OneDrive site (-my.sharepoint.com)? When I tried running this command:

Grant-PnPAzureADAppSitePermission -AppId <APP_ID> -DisplayName <DISPLAY_NAME> -Permissions Read -Site https://<acccount_name>-my.sharepoint.com/personal/<SITE NAME>

I keep getting this error:

Grant-PnPAzureADAppSitePermission: {"error":{"code":"accessDenied","message":"Access denied","innerError":{"date":"2025-12-16T23:12:59","request-id":"...","client-request-id":"..."}}}

When I run it on a regular SharePoint site, it works fine.

Here's the permission's I set on the client I used to log in with Connect-PnPOnline

User's image

Can you please advise? Thanks!

Microsoft 365 and Office | SharePoint | Development
0 comments No comments

Answer accepted by question author

Anonymous
2025-12-17T04:54:02.74+00:00

Hi Melvin

Welcome to Microsoft Q&A Forum! Have a good day and I hope you're doing well!

Thank you for bringing this up. I understand how confusing and unexpected it can be when a PnP command works fine on standard SharePoint sites but fails on a personal OneDrive site. To better support your case, I performed additional research and ran several tests in my own environment to reproduce your scenario. 

Below are the insights from my testing that I hope will help clarify the situation. 

1. I successfully reproduced your scenario and the Read permission worked in my test environment 

To verify the behavior, I executed the same command: 

Grant-PnPAzureADAppSitePermission -AppId <APP_ID> -DisplayName <DISPLAY_NAME> -Permissions Read -Site https://<tenant>-my.sharepoint.com/personal/<SITE NAME>

The command completed successfully on my personal OneDrive test site. I did not receive the accessDenied error

Here is the output from my test environment confirming that the permission was granted: User's image

2. Permissions configured on my Azure AD application 

These were the exact permissions assigned on the Azure AD application I used for testing:User's image

I recommend double-checking that your app’s permissions match.

3. Connect-PnPOnline must target the my.sharepoint.com endpoint 

One detail that can cause this exact issue is connecting PnP to the wrong endpoint. 

For OneDrive personal sites, PnP must connect to: 

https://<tenant>-my.sharepoint.com 

If you connect to: 

https://<tenant>-admin.sharepoint.com 

the operation may fail because it is pointing to the admin site collection, not the personal OneDrive site. 

If you are currently connected to the admin endpoint, please disconnect first and reconnect to the correct OneDrive URL. 

Here is the exact connection command I used:User's image

I hope the testing results and insights shared above help shed more light on the issue you're facing. Thank you again for your cooperation. I truly appreciate the effort you’ve put into troubleshooting this. If you have any questions, concerns, or if anything I said is unclear, please feel free to let me know.  


If the answer is helpful, please click "Accept 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.  

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Melvin 80 Reputation points
    2025-12-18T17:21:32.3233333+00:00

    Hi,

    Does that mean if I have to set permissions to 100 OneDrive sites, I have to become Site Collection Administrator for all 100 OneDrive sites, meaning I have to do the above steps 100 times?

    Thanks.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.