SharePoint Online: Create Site Design and Site Scripts using PowerShell

What is Site Design and Site Scripts in SharePoint Online?

Site design and site scripts are the new way to create site templates in SharePoint Online. Say, you want to create sites with a specific theme, apply a logo, set regional settings, create a list or library in the site, add users, create a content type and columns, add-remove links from the navigation, trigger a flow, Join to hub-site, add-remove site columns, etc – then make use of site designs. The best part is: Not only for new sites, but you can apply site designs to any existing sites too to deploy the artifacts and make them consistent. Remember, Feature stapling? Here too you create site design and register it with SharePoint Online site templates such as team site, or communication site.

A site script is a JSON file with a set of predefined action definitions to be executed when you apply site design. A site design acts as a container for the site script(s). You can attach one or more site scripts to site design (and a site script can be attached to more than one site design!), and when you apply the site design, you execute the actions defined in all the site scripts, and they will run in the order listed. Please note, site design is not really a site template that gets attached to the sites – but a set of actions executed when you apply a site design. So, changing site designs doesn’t change anything on existing sites (until you re-apply the site design).

How to create a Site Design in SharePoint Online?

Basically, the creation of site design works like this: You create a site script using JSON template with desired actions to run such as creating lists, applying a theme, etc., and then add the script to your tenant. The next step is to create a site design and add the site script to the design. While creating site design, you have to associate it with any modern site templates such as a team site or communication site template. That’s all. Once it’s ready, you can apply it either to a new site or existing sites. Here is my sample site design and script:

#Define Sitescript JSON
$JSONScript = @"
  "$schema": "schema.json",
  "actions": [
      "verb": "applyTheme",
      "themeName": "Corporate Theme"
      "verb": "setRegionalSettings",
      "timeZone": 24,
      "sortOrder": 25,
      "hourFormat": "12"
      "verb": "setSiteLogo",
      "url": "/Style Library/logo.jpg"
      "verb": "createSPList",
      "listName": "Work",
      "templateType": 101,
      "subactions": [
          "verb": "setTitle",
          "title": "Work"
  "bindata": {},
  "version": 1
#Set Parameters
$AdminCenterURL = ""
#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)
#Add Site Script
$SiteScript = $JSONScript | Add-SPOSiteScript -Title "Crescent Site Script"
#Add Site Design
$WebTemplate = "64" #64 = Team Site, 68 = Communication Site, 1 = Team Site without Group
Add-SPOSiteDesign -Title "Crescent Site Template" -WebTemplate $WebTemplate -SiteScripts $SiteScript.ID -Description "Crescent Site Template"

Deploy a site design in SharePoint Online

  1. Create a site script JSON Schema of required actions as per Microsoft Site design schema reference. You can also use this online tool to generate JSON schema Online JSON Designer:,  You can use my above JSON to set a theme, apply a logo, configure regional settings, and create a document library.
  2. Use the above PowerShell script to create a site script and site design. You can create up to 100 site scripts and 100 site designs per tenant!
  3. Now, you can use this site design either to new sites or you can apply it on existing sites. Here is how it works on new sites:
    • Go to SharePoint Online Admin center >> Create a new Team site by clicking “Create site” and selecting “Team site” (Since we’ve created the site design for Team Sites template)
    • You’ll see the custom site design listed in the drop-down. In my case, it is “Crescent Site Template”. 
      sharepoint online site design and site scripts
    • Click on the Finish button to trigger site creation. Once the site is created, you’ll see the actions defined in the site script is being applied.
      add site design sharepoint online
  4. To apply the site design on existing sites,  
    • Go to any site collection of specific site templates (In our case, it’s “Team Site”) >> Click on Settings gear >> Choose the “Site designs” option from the site settings menu.
      sharepoint online create site design
    • Pick the custom site design we’ve created from the list and click on the “Apply” button to apply the site design on the current site.
      sharepoint online apply site design

When the actions in the scripts are completed, SharePoint displays detailed results of those actions in a progress pane. Some more PowerShell cmdlets to manage site scripts and site designs in SharePoint Online:

  • Get-SPOSiteDesign – Retrieves all site designs created in the tenant
  • Get-SPOSiteScript – Gets the list of site scripts available
  • Set-SPOSiteDesign – Update existing site design
  • Set-SPOSiteScript – Update the site script JSON
  • Remove-SPOSiteScript – Deletes the given site script
  • Remove-SPOSiteDesign  -Removes the given site design ID
  • Invoke-SPOSiteDesign – Apply site design on existing site
  • Grant-SPOSiteDesignRights – Set permissions to use site designs
  • Revoke-SPOSiteDesignRights – Remove site design permissions

and here are some examples:

Get existing site script and Site Designs:


Update existing site script:

$SiteScriptId = "e694f7f2-ed9b-48ca-abe4-fb4fedc33c31"
$SiteScriptFile = "c:\Temp\sitescript.json"
Set-SPOSiteScript -Identity $SiteScriptId -Content (Get-Content $SiteScriptFile -Raw)

Update existing site Design:

$SiteDesignId = "4d086b5b-c7a5-4b60-a3c5-e572ff0a6b8d"
Set-SPOSiteDesign -Identity $SiteDesignId -SiteScripts "d4708c15-949c-491f-8503-cd2a67a1de66", "36f5796f-dee2-4983-80af-a08d2951df86"

Apply site Design on Existing Site:

#Set Parameters
$AdminCenterURL = ""
$SiteURL = ""
$SiteDesignId = "4d086b5b-c7a5-4b60-a3c5-e572ff0a6b8d"

#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)

#Apply Site Design
Invoke-SPOSiteDesign -Identity $SiteDesignId -WebUrl $SiteURL

Set Site Design as Default:

Set-SPOSiteDesign -Identity $SiteDesignId -IsDefault:$True

Delete existing site script and site design:

Remove-SPOSiteDesign -Identity "f6611c71-dba5-4a32-8811-51472b7e5961"
Remove-SPOSiteScript -Identity "b2ac88ee-2711-4cbc-bea9-bf63e22af735"

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

One thought on “SharePoint Online: Create Site Design and Site Scripts using PowerShell

  • March 19, 2021 at 4:45 PM

    Another excellent article. I’ve created a site template/design it works great, but i’d like to disinherit permissions for the libraries i’m creating. My example Json Script is:
    “verb”: “createSPList”,
    “listName”: “DataRoom1”,
    “templateType”: 101,
    “subactions”: [
    “verb”: “setDescription”,
    “description”: “This is a modified default Directory for External Access”

    Many thanks



Leave a Reply