SharePoint Online: Apply Theme using PnP Provisioning Template PowerShell

Requirement: Set Theme in SharePoint Online Site using PnP PowerShell Provisioning Template.

How to Change the Site Theme in SharePoint Online using PnP Provisioning Template?

In order to apply a theme to a SharePoint Online site using a PnP Provisioning Template and PowerShell, you will need to complete the following steps:

Step 1: Create a Provisioning Template Schema XML for the Theme

Go to the PnP Provisioning Schema repository in GitHub and build your provisioning template., You can also get the template from an existing site using the Get-PnPSiteTemplate cmdlet. Here is mine:

<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="">
  <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.9.1905.0, Culture=neutral, PublicKeyToken=null" />
  <pnp:Templates ID="CONTAINER-TEMPLATE-a170b11a-d4d3-486f-b191-946ff2acaec3">
    <pnp:ProvisioningTemplate ID="TEMPLATE-a170b11a-d4d3-486f-b191-946ff2acaec3" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite">
      <pnp:Theme Name="Orange" IsInverted="false" />

Make necessary changes and save this as an XML file. E.g., Pnp-Theme.xml

Step 2: PowerShell to Apply Provisioning Template

Once the template is ready, apply the template to the site using the below PnP PowerShell script.

#Config Variables
$SiteURL = ""
$TemplateXML  ="C:\Users\salaudeen\Desktop\Pnp-Theme.xml"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive

#Apply provisioning Template
Invoke-PnPSiteTemplate -path $TemplateXML

Here is the script in action

set theme in sharepoint online using pnp provisioning template

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published. Required fields are marked *