Kristi Webb is a Senior Consultant at ThreeWill. She has over 18 years of software development experience working on software solutions and integrations for enterprise and product solutions. Her passion is applying technology solutions to solve business problems and improve efficiency.
Introduction – PnP PowerShell Provisioning
After my last blog post on provisioning modern SharePoint site collections, a fellow coworker suggested creating a walkthrough of PnP PowerShell provisioning for SharePoint Site Collections, so I wanted to share the quick steps to provision a modern Team site using PnP PowerShell. Additionally, how you can easily use site templates in PnP PowerShell to customize new sites. In my example below, I was provisioning modern Team sites. This is a quick summary of what I learned when looking at PnP PowerShell for provisioning modern sites in SharePoint Online.
Steps to Extract the Site Template
If you need to install the SharePoint Online PnP PowerShell module:
- Run PowerShell as an Administrator, and run the following command: Install-Module SharePointPnPPowerShellOnline
- Connect to the SharePoint Online Site that you want to copy and make a template of: Connect-PnPOnline -Url https://{your tenant SharePoint}.sharepoint.com/sites/TeamSite
- You should be prompted for credentials, and then enter your site collection administrator credentials.
- Extract the site template to your local computer using the following command: Get-PnPProvisioningTemplate -Out “{folder location in drive}\TeamTemplate.xml” -ExcludeHandlers ApplicationLifecycleManagement,SiteSecurity -ExcludeContentTypesFromSyndication
You should see something like the following while the template file is being created:
Here is the template file that was created on my local machine:
Steps to Create a New SharePoint Team Site
Steps to Create a New SharePoint Team Site
- Create
To create a new modern Team Site named ‘TeamSite2’, run this command: New-PnPSite -Title TeamSite2 -Type TeamSite -Alias TeamSite2
- Notice
Notice that the site collection type was noted as ‘TeamSite’ to create the modern team site.
- Connect
Then connect to the new site: Connect-PnPOnline -Url https://{your tenant SharePoint}.sharepoint.com/sites/TeamSite2
Steps to Apply the Template to a new Team Site
- To apply the template created previously from the original ‘TeamSite’, run this command: Apply-PnPProvisioningTemplate -Path “{folder location in drive}\TeamTemplate.xml”

A few notes: this example was just for a modern team site. The team site was simple with no subsites. In my test example, I manually customized the home page in the ‘TeamSite’ to add the highlighted content web part, which displays site pages, before extracting the template from this site collection.



Notice above that the custom highlighted content, web part on the home page is now present in TeamSite2. It will display the current page content from the new TeamSite2 site.
Conclusion – PnP PowerShell Provisioning
Since the template is an XML file, it should be easy to customize it before applying it to new sites. Using PnP PowerShell to extract and apply site templates can be a powerful way to provision large numbers of SharePoint sites in Microsoft 365, especially when you want the look and feel to be consistent across the sites.
1 Comment
Erick Malinowski
Life saver!