Is there a way to save site as a template if you are using Modern sites? I have followed some tutorials online where you use a script to enable scripting on site. I have also made sure if the Publishing features are disabled.

Is there a way to save modern sites as template. It was easy to do in Classic sites. Is this even an option for modern sites?

4 Answers 4


We can save the modern site (modern team site and communication site) as the site template by visiting /_layouts/savetmpl.aspx page.

When you access /_layouts/savetmpl.aspx , access denied may occur. It occurs because the denyaddandcustomizepages of this site is true. DenyAddAndCustomizePages determines whether the Add And Customize Pages right is denied on the site collection. By default, the right is denied on the modern site collection.

We need to connect to SharePoint Online using PowerShell and set denyaddandcustomizepages of the site to false.

$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."

Connect-SPOService -Url https://<tenant>-admin.sharepoint.com -Credential $userCredential
set-sposite https://<tenant>.sharepoint.com/sites/<communication/team> -denyaddandcustomizepages $false

Ten, you can access /_layouts/savetmpl.aspx page and save the site as template.

  • Is this recommended approach?
    – George
    May 27, 2019 at 6:45
  • I don't think so it is a recommended approach but it did work for me.
    – hkhan
    Nov 21, 2019 at 20:42

No, Modern Team/Communication sites do not support the save as template function -- in part because it was a bad idea in the first place, and because they have Publishing functionality enabled at all times with no ability to disable it.

The closest you can come to template-like functionality is via Site Designs.

  • thank you @trevor. Let me go through the article and see if it helps me.
    – hkhan
    Jan 14, 2019 at 22:19
  • as far as my understanding goes, you need to create a site design of a site you plan to use as a template and then apply that design to other sites. Am i correct? Is there a tool that builds this schema for you for a SP site?
    – hkhan
    Jan 15, 2019 at 0:25
  • I'm not aware of a tool that builds it for you. But you have it more or less correct. Site Designs can be extended via Azure Functions and Microsoft Flow, as well.
    – user6024
    Jan 15, 2019 at 0:31

First, go-to your sharepoint admin central and allow custom scripts in the settings section

enter image description here

Now, in the SharePoint online management shell, run the following powershell commands one after the other

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

Connect-SPOService -Url https://yourname-admin.sharepoint.com/

This will prompt for user name and password

Set-SPOsite "https://yourname.sharepoint.com/sites/yoursite" -DenyAddAndCustomizePages 0

Once you run this, you should be able to save your site as template by visiting site settings and clicking on "Save site as Template"


You can create site templates of team and communication sites and it actually works quite well. http://webbrewers.com/modern-sharepoint-create-a-site-template-yes-communications-sites-too/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.