How to Clone or Copy a SharePoint Site for Testing
Question details
The user needs to clone a live modern SharePoint site to create a separate testing environment.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- Creating a safe test environment for upcoming intranet changes without affecting the live production site.
- Observed behavior
- The standard 'Save site as template' operation fails or is hidden because modern SharePoint sites block this action when unsupported apps are present.
Ensure you have SharePoint Administrator privileges, and install the SharePoint Online Management Shell before attempting to run these administrative scripts.
Enable Custom Scripts via PowerShell to Save Site as Template
Temporarily override SharePoint's security settings using PowerShell to allow saving the site as a template even with unsupported apps.
Modern SharePoint Online intentionally restricts saving sites as templates when unsupported apps are installed. By using the SharePoint Online Management Shell to temporarily allow custom scripts, administrators can bypass this block, generate the necessary template, and clone the site for external testing.
Launch the SharePoint Online Management Shell application on your computer as an administrator.
Run the command 'Connect-SPOService -Url https://yourdomain-admin.sharepoint.com' and log in with your global or SharePoint admin credentials.
Execute the command 'Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 0' (replacing <SiteURL> with the URL of the site you want to clone).
Open your live SharePoint intranet site in a web browser. Click the Gear icon (Settings) > Site Information > View all site settings.
Under the 'Site Actions' category, click on 'Save site as template'. Fill in the file name, template name, and choose whether to include content, then click OK.

A Lightweight Alternative for Handling SharePoint Documents
While managing complex SharePoint architectures requires administrative tools, editing the actual documents stored in your intranet shouldn't be difficult. WPS Office provides a free, highly compatible alternative to Microsoft Office that easily handles your everyday document management needs without straining your system resources.
- 1. Download and Install: Visit the official WPS Office website to download the free installer and follow the setup wizard.
- 2. Open Exported SharePoint Files: Launch WPS Office and open the Word, Excel, or PowerPoint documents downloaded from your SharePoint site.
- 3. Edit and Save: Edit your documents seamlessly with full formatting preserved, then save them back to your local drive or directly sync them to your cloud storage.

Frequently Asked Questions
Why does my modern SharePoint site fail to save as a template?
Modern SharePoint sites often contain newer web parts and apps that are not supported by the classic template engine. When SharePoint detects these unsupported apps, it disables or fails the 'Save site as template' feature to prevent data corruption.
Can I use individual page templates instead of cloning the whole site?
While you can save individual pages as templates within the site's Pages library, this only duplicates page layouts. It does not replicate the backend lists, document libraries, or site structure needed to accurately test upcoming tenant-wide changes.
How do I revert the custom script setting after saving the template?
To restore the default security restriction, open the SharePoint Online Management Shell again and run the command 'Set-SPOSite <SiteURL> -DenyAddAndCustomizePages 1'. This will disable custom scripts and protect your live site.




