The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
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:
2. Permissions configured on my Azure AD application
These were the exact permissions assigned on the Azure AD application I used for testing:
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:
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.