Create a SharePoint site collection in an Office 365 Tenant with PnP PowerShell

Before getting started with PnP PowerShell you need to ensure you have the pre-requisites enabled on your machine. I have detailed the pre-reqs here in previous GitHub repos I have done for our products here at OnePlace Solutions and as we will be targeting SharePoint Online we need to ensure we install the PnP cmdlets for SharePoint online only:

This blog post details how you can create a site collection in an Office 365 tenant using PowerShell.

I have added a PowerShell script to my GitHub repo which I will go through in more detail.

The script that provisions the site collection is here:

This script prompts for key information to provision the site collection with. The site template is based on the standard ‘Team Site’ template in SharePoint, however this information could be prompted for and added dynamically to your script.

To execute this script and provision a site collection do the following:

  • Start PowerShell on your machine
  • Copy and paste the following command into your PowerShell command window:
    Invoke-Expression (New-Object Net.WebClient).DownloadString(‘')
  • Enter your SharePoint tenant url and you will be prompted to login, use your email address :


  • Enter the url of your new site collection to be provisioned:
  • SNAGHTML9009eba

    • Enter the site owner of your new site collection by typing in the email address
    • Enter the timezone, I type 76 as I live in Sydney
    • The new site collection will now be provisioned in Office 365. To confirm and check progress go into the SharePoint Admin area of your tenant and go to the list of site collections and you will see your new site collection:


    The command used in this script is:


    Here is the official documentation on this cmdlet:

    I extend the provisioning process in my other blog post where administrators can create a csv file defining multiple site collections, the template they are based on, the urls, site owners, regional settings etc. and provision them all with PowerShell in an Office 365 tenant:


    1 thought on “Create a SharePoint site collection in an Office 365 Tenant with PnP PowerShell

    1. Pingback: Provision multiple SharePoint site collections with PnP PowerShell | Colin Wood

    Leave a Reply

    Fill in your details below or click an icon to log in: Logo

    You are commenting using your account. Log Out /  Change )

    Google photo

    You are commenting using your Google account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    Connecting to %s