Create, Deploy and Apply a Site Template/ Site Design to a Modern SharePoint site using PowerShell

Create, Deploy and Apply a Site Template/ Site Design In Modern SharePoint using PowerShell

Site Design JSON Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/site-design-json-schema#add-a-navigation-link

You can watch the full video here:

 

JSON Scripts (site design json – demo.txt):

{
  “$schema”: “schema.json”,
  “actions”: [
{
  “verb”: “applyTheme”,
  “themeName”: “Theme”
},
{
  “verb”: “setSiteLogo”,
  “url”: “https://yourtenant.sharepoint.com/SiteAssets/logo.jpg”
},
{
  “verb”: “addNavLink”,
  “url”: “https://www.youtube.com/”,
  “displayName”: “YouTube”,
  “isWebRelative”: true
},
{
  “verb”: “removeNavLink”,
  “displayName”: “Home”,
  “isWebRelative”: true
},
{
  “verb”: “removeNavLink”,
  “displayName”: “Documents”,
  “isWebRelative”: true
},
{
  “verb”: “removeNavLink”,
  “displayName”: “Site contents”,
  “isWebRelative”: true
},
{
  “verb”: “removeNavLink”,
  “displayName”: “Pages”,
  “isWebRelative”: true
}
  ],
  “bindata”: { },
  “version”: 1
}
PowerShell Scripts:
$adminSiteUrl = “https://yourtenant-admin.sharepoint.com/”
$title = “WeTechCareOfYou Template Demo”
$description = “Create a new site with WeTechCareOfYou branding, logo and links applied”
$siteScriptFile = “C:\Users\kylec\Desktop\wtcoy site template demo\site design json – demo.txt”
$WebTemplate = “68” #64 is team site, 68 is communication site
$previewImageURL = “https://yourtenant.sharepoint.com/SiteAssets/WTCOYlogo.jpg”
Connect-SPOService $adminSiteUrl
$jsonFileContent = Get-Content $siteScriptFile -Raw
$siteScript = Add-SPOSiteScript -Title $title -Content $jsonFileContent | Select -First 1 Id
Add-SPOSiteDesign -SiteScripts $siteScript.Id -Title $title -WebTemplate $webTemplate -Description $description -PreviewImageUrl $previewImageUrl