Share via

How can we migrate site pages between modern sites without requiring custom scripting enabled?

TonyLandicho-3302 0 Reputation points
2026-02-13T19:35:29.06+00:00

We are trying to implement a DevOps process that migrates site pages between a non-prod site and a production site. We know that custom scripting is generally turned off in SharePoint Online modern sites. Yet, when we migrate modern pages with out of the box web parts, we get an error in ShareGate saying custom scripting must be enabled in the target site. Therefore, how can we migrate site pages between modern sites without requiring custom scripting enabled?

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Austin-H 8,335 Reputation points Microsoft External Staff Moderator
    2026-02-14T03:23:49.15+00:00

    Hello TonyLandicho-3302
    Thanks for raising this question on the Q&A forum.

    I wanted to clarify an important point regarding modern page migration. Based on Microsoft’s guidance and ShareGate’s official documentation, migrating modern ASPX pages between modern sites requires Custom Script to be temporarily enabled on the destination site. This is due to SharePoint Online’s NoScript security policy, which prevents migration tools from creating or modifying ASPX pages while DenyAddAndCustomizePages is set to 1

    If you’re using ShareGate, the recommended approach is:

    • Temporarily enable Custom Script on the target site using the SharePoint Online Management Shell.
    • Run the migration again.
    • Re-disable Custom Script after the migration completes to restore the expected security posture.

    References:

    SPMT supported SharePoint web parts

    The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.

    Copying to a Microsoft 365 Site Collection requires Custom Scripts to be enabled at the destination

    Note: This information is provided as a convenience to you. These sites are not controlled by Microsoft, and Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please ensure that you fully understand the risks before using any suggestions from the above link.

    Hope this information helps.


    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.


  2. Q&A Assist
    2026-02-13T19:35:36.5033333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To migrate site pages between modern sites in SharePoint Online without requiring custom scripting, you can utilize the SharePoint Framework (SPFx) for your migration process. Since custom scripting is generally turned off in modern sites, using SPFx allows you to deploy client-side web parts that adhere to the no-script policy, thus avoiding the need for custom scripting to be enabled.

    Additionally, ensure that you are using out-of-the-box web parts that are compatible with the modern page structure. If you encounter issues with tools like ShareGate, verify that the target site has the modern page capability enabled and that any required features are activated.

    For further assistance, consider using the SharePoint Modernization scanner to identify any issues with modern page features on your sites. This tool can help ensure that the necessary configurations are in place before migration.


    References:

    0 comments No comments

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.