SharePoint  

PnP Template Provisioning for SharePoint

SharePoint provisioning is one of the most powerful features of the PnP ecosystem. Whether you want to automate site creation, deploy list structures, apply branding, or configure complex sites, PnP Provisioning Templates (.xml or .pnp) make the job extremely easy.

This guide explains provisioning in plain language, with real examples, including the XML and .pnp formats and PnP PowerShell commands.

What Is PnP Provisioning?

PnP Provisioning lets you define a SharePoint site structure in a template and then apply that template to other sites.

You can provision:

  • Site Columns

  • Content Types

  • Lists & Libraries

  • Navigation

  • Branding

  • Pages

  • Webparts

  • Permissions

  • Themes

The template can be stored as:

  • XML file — editable template

  • .pnp file — packaged template (zip format with assets)

Getting Started with PnP PowerShell

Install PnP PowerShell

Install-Module PnP.PowerShell -Scope CurrentUser

How to Export an Existing Site Template

You can extract an existing site and use it as a template.

Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/Test -Interactive

Get-PnPSiteTemplate -Out "SiteTemplate.xml"

Basic Structure of a Provisioning XML

Below is a simple XML template:

<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2022/09/ProvisioningSchema">

  <pnp:Preferences Author="PnP" Version="1.0"/>

  <pnp:Templates>
    <pnp:ProvisioningTemplate ID="BaseTemplate" Version="1">

      <!-- ===== Site Fields ===== -->
      <pnp:SiteFields>
        <Field ID="{1E3A5EC0-1111-4444-8888-222222222222}"
               Name="ProjectCode"
               DisplayName="Project Code"
               Type="Text"
               Required="FALSE" />
      </pnp:SiteFields>

      <!-- ===== Content Types ===== -->
      <pnp:ContentTypes>
        <pnp:ContentType ID="0x0100AABBCC"   Name="Project Document"    Group="Custom Content Types">
          <pnp:FieldRefs>
            <pnp:FieldRef ID="{1E3A5EC0-1111-4444-8888-222222222222}" />
          </pnp:FieldRefs>
        </pnp:ContentType>
      </pnp:ContentTypes>

      <!-- ===== Lists ===== -->
      <pnp:Lists>
        <pnp:ListInstance  Title="Projects" TemplateType="100"  Url="Lists/Projects">
          <pnp:Fields>
            <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"  Name="Title" DisplayName="Project Title" Type="Text" />           
          </pnp:Fields>
        </pnp:ListInstance>
      </pnp:Lists>

    </pnp:ProvisioningTemplate>
  </pnp:Templates>
</pnp:Provisioning>

Deploying / Applying a Template

Apply XML Template

Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/TargetSite -Interactive

Invoke-PnPSiteTemplate -Path "SiteTemplate.xml"

Adding Pages & Web Parts in Templates

Adding a modern page

<pnp:ClientSidePages>
  <pnp:ClientSidePage PageName="Home.aspx" PromoteAs="HomePage">
    <pnp:Sections>
      <pnp:Section Order="1" Type="OneColumn">
        <pnp:Controls>
          <pnp:CanvasControl  WebPartType="Text" Order="1">
            <pnp:CanvasControlProperties>
              <pnp:CanvasControlProperty  Key="Text" Value="Welcome to the site!" />
            </pnp:CanvasControlProperties>          
          </pnp:CanvasControl>
        </pnp:Controls>
      </pnp:Section>
    </pnp:Sections>
  </pnp:ClientSidePage>
</pnp:ClientSidePages>

Adding Navigation

Navigation XML Example

<pnp:Navigation>
   <pnp:GlobalNavigation NavigationType="Structural">
   <pnp:StructuralNavigation>
        <pnp:NavigationNode Title="Home" Url="https://tenant.sharepoint.com/sites/Test" IsExternal="true" />
        <pnp:NavigationNode Title="Documents" Url="https://tenant.sharepoint.com/sites/Test/Shared%20Documents" IsExternal="true" />    
  </pnp:StructuralNavigation>
</pnp:GlobalNavigation>
</pnp:Navigation>

Adding Files (Images, Scripts, Assets)

<pnp:Files>
  <pnp:File Src="files/banner.png" Folder="SiteAssets" Overwrite="true"  Level="Published"/>
</pnp:Files>

Provision a Site Collection with Template

# 1. Create site
New-PnPTenantSite -Url "https://tenant.sharepoint.com/sites/ProjectSite" `
                  -Title "Project Site" `
                  -Owner "[email protected]"

# 2. Apply PnP template
Invoke-PnPSiteTemplate -Path "ProjectTemplate.xml"

Conclusion

PnP PowerShell provisioning gives you a fast, consistent way to deploy SharePoint sites using reusable XML or .pnp templates. Instead of manually creating fields, lists, pages, and content types, you can automate everything with a single command. Content type provisioning adds even more structure, ensuring your metadata and information architecture stay clean and standardized across environments.

By following best practices and organizing your templates properly, PnP provisioning becomes a reliable and scalable method for SharePoint deployment. It saves time, reduces manual errors, and helps maintain consistency—from development to production.