When migrating from SharePoint On-Premises to SharePoint Online (Modern sites) and got the following error:
Exception: Access denied. You do not have permission to perform this action or access this resource
This error may appear for the following components:
This "AddandCustomizePages" permission is related to the scripting capabilities in sites and pages of Microsoft 365.
For security purposes, scripting is not allowed on sites users create themselves, on modern team and communication sites, and on the root site for your organization by default.
1. Download and Install SharePoint Online Management Shell
2. Run SharePoint Online Management Shell as an Administrator
3. Execute the following commands to enable the AddandCustomizePages permission level on the site collection in Office 365, then attempt the migration again:
Connect-SPOService -Url https://domain-admin.sharepoint.com
Set-SPOSite https://domain.sharepoint.com/sites/SiteCollectionName -DenyAddAndCustomizePages 0
Note: Replace domain and SiteCollectionName accordingly, for example:
Connect-SPOService -Url https://quest-admin.sharepoint.com
Set-SPOSite https://quest.sharepoint.com/sites/Support -DenyAddAndCustomizePages 0
© ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center