How to Create a SharePoint Online Site Using PowerShell?

You know those days when your manager suddenly says, “We need three new project sites by the end of the day”? Or when every new team asks for “a similar SharePoint site like Finance, but with our own name and permissions”? Doing this a few times in the SharePoint admin center is fine, but once it becomes a regular thing, it quickly turns into a repetitive job.

This is where PowerShell can help you. Instead of clicking through multiple screens for each new SharePoint site, you can run a script, pass a few parameters, and have sites created in a consistent, predictable way. You save time, reduce mistakes, and it becomes much easier to follow your organization’s naming, security, and storage rules.

In this tutorial, I’ll show you how to create a SharePoint Online site using PowerShell, step by step. We’ll look at both the SharePoint Online Management Shell and PnP PowerShell, and we’ll walk through practical examples for team sites and communication sites. My goal is to keep it simple, use plain language, and give you copy‑paste friendly scripts you can tweak for your own environment.

If you only create a SharePoint site once in a while, doing it from the SharePoint admin center is fine. But when you need to create multiple sites, keep consistent settings, or automate provisioning, PowerShell saves a lot of time.

I will show you both Microsoft’s SharePoint Online Management Shell and PnP PowerShell, so you can pick what works best for you.

Additionally, we can use Visual Studio Code or Windows PowerShell ISE to execute the PowerShell commands.

NOTE:

-> In SharePoint Online Management Shell, you can create different types of SharePoint sites by changing the Template parameter with the template name. -> In PnP PowerShell, you can change the Type parameter with the type of SharePoint site.

So, let’s start.

Prerequisites

Before you run any commands, make sure your environment is ready.

  1. Permissions

You should be a SharePoint Administrator or Global Administrator in your Microsoft 365 tenant. Without this, the SharePoint site creation commands will fail.

  1. Install SharePoint Online Management Shell

On your admin machine: Install the SharePoint Online Management Shell module (PowerShell 5.1 or later). You can install it from the PowerShell Gallery using the below cmdlet:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser

This module gives you cmdlets like Connect-SPOService and New-SPOSite.

  1. Install PnP PowerShell

PnP PowerShell is a community‑driven module that makes many SharePoint tasks easier and more powerful. You can install PnP PowerShell using:

Install-Module -Name PnP.PowerShell -Scope CurrentUser

PnP PowerShell supports modern authentication methods and works across SharePoint, Teams, and more.

Connecting to SharePoint Online from PowerShell

Before you can create sites in SharePoint, you need to connect to your tenant.

  • Using SharePoint Online Management Shell

First, you need the SharePoint admin center URL, which usually looks like:

$AdminCenterUrl = "https://yourtenant-admin.sharepoint.com"
Connect-SPOService -Url $AdminCenterUrl

You will be prompted to sign in with your admin credentials.

  • Using PnP PowerShell

For PnP, you normally connect directly to the SharePoint admin center as well:

$AdminCenterUrl = "https://yourtenant-admin.sharepoint.com"
Connect-PnPOnline -Url $AdminCenterUrl -Interactive

The -Interactive parameter opens a modern sign‑in window and supports MFA.

Check out Delete a SharePoint Online Site Using PowerShell

Create Sites with SharePoint Online Management Shell

The core cmdlet for creating sites in SharePoint Online in this module is New-SPOSite.

New-SPOSite syntax (simplified)

The simplified version of the syntax looks like this:

New-SPOSite `
  -Url <SiteUrl> `
  -Owner <OwnerEmail> `
  -StorageQuota <QuotaInMB> `
  -Title <SiteTitle> `
  -Template <TemplateId> `
  -TimeZoneId <TimeZoneId> `
  -LocaleId <LocaleId>

Some key parameters:

  • Url: Full URL of the SharePoint site collection, usually under /sites/ or /teams/.
  • Owner: Primary SharePoint site collection admin (usually a user’s email).
  • StorageQuota: Maximum storage in MB for that site.
  • Title: Site title users will see.
  • Template: Site template ID, for example:
    • STS#3 – Team site (no Microsoft 365 group)
    • STS#0 – Classic team site
    • SITEPAGEPUBLISHING#0 – Communication site
  • TimeZoneId: Numeric ID for the time zone.
  • LocaleId (LCID): Language/locale (for example, 1033 for English – United States).

Example 1: Create a blank site without specifying a template

If you skip the Template parameter, SharePoint lets you choose the template later in the browser.

New-SPOSite `
  -Url "https://yourtenant.sharepoint.com/sites/HumanResourceManagementTeam" `
  -Owner "[email protected]" `
  -StorageQuota 2048

You can see in the screenshot below, I executed the script using PowerShell ISE.

power automate flow send email from shared mailbox html

What happens next:

  • The SharePoint Online site is created as a blank site collection with no template applied yet.
  • When you open the URL in the browser, SharePoint will ask you to pick a template and configure permissions.

You can see the site got created like in the screenshot below:

power automate send email from shared mailbox html

This is handy if you are not sure yet which template you want.

The SharePoint site will be created with the Template Name, as shown in the screenshot below. If you provide the Title parameter in the PowerShell script, it will be created with the given title name.

how to create a sharepoint site using powershell

Read Add SharePoint Online List Items Using PnP PowerShell

Example 2: Create a communication site

To create a communication site in SharePoint directly from PowerShell, you use the communication template ID.

Below is the PowerShell script:

New-SPOSite `
  -Url "https://yourtenant.sharepoint.com/sites/ProjectCommunication" `
  -Owner "[email protected]" `
  -StorageQuota 2048 `
  -Title "Project Communication" `
  -Template "SITEPAGEPUBLISHING#0" `
  -LocaleId 1033

The SharePoint communication site Template is “SITEPAGEPUBLISHING#0”.

This gives you a modern communication site in SharePoint, which is great for announcements, news, and top‑down communication.

The SharePoint site will be created with the given title. You can access it through the SharePoint admin center or the provided site URL. The site can be viewed as shown in the below screenshot.

how to create a sharepoint site using sharepoint online management shell

Example 3: Create a modern team site (no Microsoft 365 Group)

If you want a modern SharePoint team site that is not connected to a Microsoft 365 group, you can use the STS#3 template.

New-SPOSite `
  -Url "https://yourtenant.sharepoint.com/sites/EventPlanning" `
  -Owner "[email protected]" `
  -StorageQuota 2048 `
  -Title "Event Planning" `
  -Template "STS#3" `
  -NoWait `
  -TimeZoneId 11 `
  -CompatibilityLevel 15

A few notes:

  • TimeZoneId 11 corresponds to a US Central Time zone.
  • CompatibilityLevel 15 is kept for backward compatibility and is required in some environments.
  • -NoWait returns control to your PowerShell session immediately while the site is still being created in the background.

This PowerShell command will be executed immediately. It will create the SharePoint team site with the provided title. This site is not connected with Microsoft 365 Groups.

Check out Get SharePoint Site Storage Size Using PowerShell

Create SharePoint Sites with PnP PowerShell

PnP PowerShell uses the New-PnPSite cmdlet for modern SharePoint sites (team and communication).

You can create:

  • Microsoft 365 group‑connected team sites.
  • Communication sites.
  • Team sites without Microsoft 365 groups.

New-PnPSite syntax (high level)

There are three main patterns:

  • SharePoint Team site connected to a Microsoft 365 group:
New-PnPSite -Type TeamSite -Title <Title> -Alias <GroupAlias> [...]
  • SharePoint Communication site:
New-PnPSite -Type CommunicationSite -Title <Title> -Url <Url> [...]
  • SharePoint Team site without Microsoft 365 group:
New-PnPSite -Type TeamSiteWithoutMicrosoft365Group -Title <Title> -Url <Url> [...]

Important parameters you will see a lot:

  • TypeTeamSiteCommunicationSite, or TeamSiteWithoutMicrosoft365Group.
  • Title: Display name of the site.
  • Alias: For group‑connected team sites, used in the group email and URL.
  • Url: Full URL for communication or non‑group team sites.
  • IsPublic: Whether the group‑connected team site is public or private.
  • Owners: One or more site owners.
  • SiteDesign / SiteDesignId: Controls which modern site design is applied (Blank, Topic, Showcase, or custom).
  • Classification: Site classification label like “HBI” (high business impact).
  • TimeZone: Time zone enum value.
  • ShareByEmailEnabled: Allows sharing with external users via email.

Read Get the SharePoint Site Owner Using PowerShell

Example 4: Create a Microsoft 365 group‑connected team site

This is the typical “modern” SharePoint team site that comes with a group, mailbox, and Planner.

New-PnPSite `
  -Type TeamSite `
  -Title "Event Planning" `
  -Alias "EventPlanning" `
  -Wait `
  -Description "This site contains all planning information about specific events." `
  -IsPublic `
  -Owners "[email protected]","[email protected]"

Or like this:

New-PnPSite -Type TeamSite -Title "Event Planning" -Alias EventPlanning -Wait -Description "This site contain all the planning information about sepcific event" -IsPublic -Owners [[email protected], [email protected]]

What this does:

  • Creates a Microsoft 365 group named “Event Planning”.
  • Creates a SharePoint team site connected to that group.
  • Sets the group and site as public (anyone in the organization can join).
  • Waits until the site is fully created before returning (-Wait).

Here is the exact output in the screenshot below:

power automate remove all special characters from string

Check out Get All Microsoft 365 Group Connected SharePoint Sites using PowerShell

Example 5: Create a communication site with PnP PowerShell

Communication sites are often used for portals, intranet home pages, or information‑only sites.

New-PnPSite `
  -Type CommunicationSite `
  -Title "Event Management" `
  -Url "https://yourtenant.sharepoint.com/sites/EventManagement" `
  -Owner "[email protected]" `
  -SiteDesign "Blank" `
  -ShareByEmailEnabled `
  -Classification "HBI" `
  -TimeZone "UTC_MONROVIA"

Here’s what is happening:

  • SiteDesign "Blank" gives you a clean starting point.
  • ShareByEmailEnabled lets owners share content with external users if your tenant allows it.
  • Classification "HBI" tags the site with a classification that can tie into governance or sensitivity rules.

You can also use SiteDesign "Topic" or SiteDesign "Showcase" depending on the layout you prefer. Here is the output you can see in the screenshot below:

power automate length of string

Check out Enable Item-level Permissions in a SharePoint Document Library Using PowerShell

Example 6: Create a team site without Microsoft 365 Group

If you want a modern team site but do not want a group, mailbox, or Planner, you can use the TeamSiteWithoutMicrosoft365Group type.

New-PnPSite `
  -Type TeamSiteWithoutMicrosoft365Group `
  -Title "Project Planning" `
  -Url "https://yourtenant.sharepoint.com/sites/ProjectPlanning" `
  -Classification "HBI" `
  -ShareByEmailEnabled

This creates a standalone modern team site in SharePoint, which is perfect for controlled or backend sites where you don’t need a full Microsoft 365 group.

You can see the exact output in the screenshot below:

power automate remove all special characters from string

Choosing the Right SharePoint Site Type

Here is a quick way to think about which option to use.

ScenarioRecommended typeExample template / type
Team needs files, calendar, Planner, and mailboxGroup‑connected team siteNew-PnPSite -Type TeamSite -Alias <Alias>
Department or project team, no group neededTeam site without Microsoft 365 groupSTS#3 or TeamSiteWithoutMicrosoft365Group
Intranet home page, news, announcementsCommunication siteSITEPAGEPUBLISHING#0 or CommunicationSite
Classic customizations or older solutionsClassic team siteSTS#0

Team sites are better for collaboration, while communication sites are better for broadcasting information to a wider audience in SharePoint.

Best Practices

To make your scripts more robust and easier to manage, keep these points in mind.

  • Use variables for tenant‑specific values like admin URLs, owners, and base URLs so you can reuse scripts across environments.
  • Decide and enforce a naming convention for site URLs (for example, /sites/Dept-Name or /sites/PRJ-ProjectCode).
  • Always think about storage quota, sharing settings, and classification up front, so you do not have to fix them later.
  • If you have a standard site structure (libraries, columns, navigation, etc.), consider building a PnP provisioning template and applying it after site creation.
  • For larger automation scenarios, you can loop through a CSV file and create multiple sites in one shot using New-SPOSite or New-PnPSite.

Wrap‑up

Using PowerShell to create SharePoint Online sites gives you speed, consistency, and control. In this tutorial, we looked at two main options: New-SPOSite from the SharePoint Online Management Shell, and New-PnPSite from PnP PowerShell.

With New-SPOSite, you can quickly create different types of site collections from the SharePoint Online Management Shell. With New-PnPSite, you get an easier and more flexible way to create modern team and communication sites, including group‑connected and non‑group options.

Do let me know in the comment below if these scripts helps you.

You may also like the following tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…