Introduction
Hi guys, as we all know, saving a site as a template option is not available on Modern Sites. We only have the option to make a copy using some migration tools like ShareGate, Metallogix, and others. Apart from this, let’s explore a new conceptual way of making a clone or a copy to an existing modern source site collection using PnP PowerShell.
Steps
Open SharePoint Online Management Shell.
Run the Command to connect to your Source site
Connect-PnPOnline -Url <Enter Your Modern Source Site url> -UseWebLogin
Get the Template of the above Modern Source site using PnP Powershell script
Get-PnPProvisioningTemplate -Out “D:\MyApplications.xml”
Let the Template Extraction happen in the above path as mentioned in an XML file format.
Run the below script to make the Modern Target site
New-PnPSite -Type CommunicationSite -Title ‘TESTMyApplications’ -URL https://<TenantName>.sharepoint.com/sites/TESTMyApplications
After creating the above Comm site now try to Apply the extracted PnP Template only after Connecting it to that new Modern Target Site by running the scripts
Connect-PnPOnline -Url <Enter Your Modern Target Site url> -UseWebLogin
Apply-PnPProvisioningTemplate -Path “D:\MyApplications.xml”
Finally, you will have the new Modern Cloned Target Site Collection ready which has the same exact replica along with content as that in your Modern Source Site Collection.
Note: In the above example, I am creating a Modern Communication Target Site to be cloned. The same steps can be used for if the modern team target site and your source is a Modern Team Site. We just need to tune the scripts and run in the same format.
If your Source Modern Site is a Hub we have to also Register the Modern Target Site as a Hub either through SPOnline PowerShell[Register-SPOHubSite <Enter Your Modern Target Site url> -Principals $null] OR through the Modern Admin Centre [https://<TenantName>-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/home].
Happy Modern SharePoint Cloning of your Modern Sites!