Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

How to Create a Site in SharePoint Online Using PnP PowerShell

Our marketing team wanted a new intranet site for campaign news, and they wanted it the same way every time: English, Eastern time, the Topic layout and a clean URL. Clicking through Create site in SharePoint works once, but it’s slow and easy to get wrong when you build sites for several departments.

That’s where PnP PowerShell earns its keep. I’ll show you how I create communication sites and team sites with New-PnPSite, using a real site I built in my own Microsoft 365 tenant, plus the classic New-PnPTenantSite cmdlet, bulk creation from a CSV file and fixes for the errors you’ll hit.

Quick answer: Connect with Connect-PnPOnline -Url https://contoso-admin.sharepoint.com -ClientId <your-app-id> -Interactive, then run New-PnPSite -Type CommunicationSite -Title "Marketing" -Url https://contoso.sharepoint.com/sites/Marketing. Use -Type TeamSite -Alias Marketing for a team site with a Microsoft 365 group, or -Type TeamSiteWithoutMicrosoft365Group for a team site without one.

Which type of SharePoint site should you create?

New-PnPSite creates modern sites only, and its -Type parameter decides which kind. Pick the type first, because a few parameters only exist for one type. If you’re unsure which fits, I compare them in detail in the difference between team sites and communication sites.

-Type valueWhat you getRequired parameters
CommunicationSiteA site for publishing news and pages to a wide audience; no Microsoft 365 group-Title, -Url
TeamSiteA team site connected to a new Microsoft 365 group (shared mailbox, calendar, Planner, Teams-ready)-Title, -Alias
TeamSiteWithoutMicrosoft365GroupA modern team site for collaboration without a group (template STS#3)-Title, -Url

Prefer the browser for a one-off site? My guide on how to create a SharePoint site covers the Create site wizard.

Before you start: module, connection and permissions

You need PnP PowerShell in PowerShell 7.4 or later and your own Entra ID app registration, because Connect-PnPOnline requires a -ClientId. If you haven’t set that up yet, start with installing PnP PowerShell for SharePoint Online.

I connect to the SharePoint admin center, because the same connection also runs Get-PnPTenantSite to check URLs and confirm the result:

$adminUrl = "https://contoso-admin.sharepoint.com"
$clientId = "00000000-0000-0000-0000-000000000000"   # your Entra ID app's client ID

Connect-PnPOnline -Url $adminUrl -ClientId $clientId -Interactive
  • Who can create sites: a SharePoint Administrator or Global Administrator always can. Regular users can only if the admin center setting Users can create SharePoint sites is on; Microsoft notes that this setting also covers the PnP cmdlet and the REST API.
  • App permissions: the app needs SharePoint AllSites.FullControl (delegated) or Sites.FullControl.All (application). Group-connected team sites also need Microsoft Graph Group.ReadWrite.All.
  • Owner: with a delegated sign-in, you become the site owner unless you pass -Owner (or -Owners for team sites). App-only connections must pass one.

Create a communication site with New-PnPSite

Here’s the script I ran to create the Contoso Marketing Demo site. It checks that the URL is free first, then creates the site with US English (LCID 1033), Eastern time and the Topic design:

New-PnPSite creating a SharePoint Online communication site with PnP PowerShell in PowerShell 7

New-PnPSite returns the new site’s URL, and in my tenant that took 4 seconds. A few notes on the parameters:

  • -SiteDesign takes Topic, Showcase or Blank, the same three designs you see in the browser. It works only for communication sites.
  • -SiteDesignId applies your own site design by its GUID instead, and it works for every type. Custom designs come from a site script you’ve registered; see creating a custom site template in SharePoint Online.
  • -Lcid sets the site language, and you can’t change it later. 1033 is English (United States).
  • -TimeZone takes a named value such as UTCMINUS0500_EASTERN_TIME_US_AND_CANADA; press Tab after the parameter to cycle through them.
  • -Wait makes the cmdlet wait until SharePoint has fully provisioned the site. I skip it for a single site and use it in scripts that immediately add lists or pages.

Verify the new site’s template, language and time zone

I never trust a create command until I’ve read the site back. Get-PnPTenantSite shows the template and locale from the admin side, and connecting to the site itself shows the time zone that users will see in dates and calendars:

Get-PnPTenantSite and Get-PnPWeb verifying the new communication site template, language and time zone

SITEPAGEPUBLISHING#0 is the communication site template, and the time zone came through as Eastern. SharingCapability is Disabled here because new sites inherit the tenant’s sharing level. If a time zone ever comes out wrong, you can fix it later in SharePoint site regional settings.

Create a team site connected to a Microsoft 365 group

A group-connected team site needs an -Alias instead of a URL. The alias becomes the group’s email address and, by default, the site URL under /sites or /teams, depending on your tenant’s site creation setting. Use -SiteAlias if the URL should differ from the alias.

New-PnPSite -Type TeamSite `
    -Title "Sales Team" `
    -Alias "SalesTeam" `
    -Description "Sales pipeline, proposals and weekly reports" `
    -Owners "megan@contoso.com", "alex@contoso.com" `
    -Lcid 1033 `
    -TimeZone UTCMINUS0600_CENTRAL_TIME_US_AND_CANADA `
    -Wait

Without -IsPublic the group is private, which is what I want for most departments. Only add -IsPublic when anyone in the organization should be able to join. The people in -Owners become group owners and site owners; see the SharePoint site owner guide for what that role can do.

This type creates a Microsoft 365 group, so it needs the Graph permission mentioned earlier. It also doesn’t work over a legacy ACS (client secret) app-only connection, because that connection can’t get a Graph token.

Create a team site without a Microsoft 365 group

For an archive, a document center or a site that shouldn’t create a mailbox and a group in Outlook, use the TeamSiteWithoutMicrosoft365Group type. It takes a full URL, just like a communication site:

New-PnPSite -Type TeamSiteWithoutMicrosoft365Group `
    -Title "Finance Archive" `
    -Url "https://contoso.sharepoint.com/sites/FinanceArchive" `
    -Owner "adele@contoso.com" `
    -TimeZone UTCMINUS0800_PACIFIC_TIME_US_AND_CANADA

You can still connect a group later from the site settings if the team grows. Once the site exists, set up its libraries with creating document libraries using PnP PowerShell.

Use New-PnPTenantSite for templates and storage quotas

New-PnPTenantSite is the older, admin-only way to create a site collection. I use it when I need a storage quota at creation time or an exact template ID. It requires -Owner and a numeric -TimeZone, and the owner must be a user, not a group:

New-PnPTenantSite `
    -Title "Project Phoenix" `
    -Url "https://contoso.sharepoint.com/sites/ProjectPhoenix" `
    -Owner "megan@contoso.com" `
    -Template "STS#3" `
    -Lcid 1033 `
    -TimeZone 10 `
    -StorageQuota 51200 `
    -Wait

-StorageQuota is in megabytes, so 51200 is 50 GB. To find the right time zone ID and template name, ask SharePoint instead of guessing:

Get-PnPTimeZoneId and Get-PnPWebTemplates listing US time zone IDs and modern site templates

STS#3 is the modern team site without a group and SITEPAGEPUBLISHING#0 is a communication site. The template and the -Lcid must be a valid combination, or the command fails.

Create multiple sites from a CSV file

When a client asks for a dozen department sites, I put them in a CSV file and loop through it. The script skips URLs that already exist and keeps going if one site fails, so a single typo doesn’t stop the batch:

# sites.csv columns: Title,Url,Type   (Type = CommunicationSite or TeamSiteWithoutMicrosoft365Group)
$sites = Import-Csv -Path "C:\Scripts\sites.csv"

foreach ($site in $sites) {
    $exists = try { Get-PnPTenantSite -Identity $site.Url -ErrorAction Stop } catch { $null }
    if ($exists) { Write-Warning "Skipped (exists): $($site.Url)"; continue }

    try {
        $url = New-PnPSite -Type $site.Type -Title $site.Title -Url $site.Url `
            -Lcid 1033 -TimeZone UTCMINUS0500_EASTERN_TIME_US_AND_CANADA -ErrorAction Stop
        Write-Host "Created: $url"
    }
    catch {
        Write-Warning "Failed: $($site.Url) - $($_.Exception.Message)"
    }
}

Run it once against two test rows before the full list. For more ready-to-use automation, see my PnP PowerShell scripts for SharePoint developers.

Create a site with New-SPOSite (SharePoint Online Management Shell)

If your scripts already use the SharePoint Online Management Shell, you can create sites with New-SPOSite instead of PnP. Connect to the admin center with Connect-SPOService, then pass the site URL, the owner and a storage quota. Those three parameters are required.

# Connect to the SharePoint admin center (a sign-in window opens)
Connect-SPOService -Url "https://spguides-admin.sharepoint.com"

# Create a communication site
New-SPOSite -Url "https://spguides.sharepoint.com/sites/ProjectCommunication" `
    -Owner "admin@spguides.onmicrosoft.com" `
    -StorageQuota 2048 `
    -Title "Project Communication" `
    -Template "SITEPAGEPUBLISHING#0" `
    -LocaleId 1033

-StorageQuota is in megabytes, so 2048 means 2 GB. -Owner must be an email-enabled user, not a security group. You need to be at least a SharePoint Administrator to run the cmdlet.

Open the URL when the command finishes. The new communication site is ready, with the title you passed in -Title.

New communication site created with New-SPOSite in SharePoint Online

Template names you will use most

  • SITEPAGEPUBLISHING#0 creates a communication site.
  • STS#3 creates a modern team site without a Microsoft 365 group.
  • STS#0 creates a classic team site.
  • Leave out -Template, and SharePoint asks you to pick a template the first time you open the site.

The template and the locale must be a valid pair. Run Get-SPOWebTemplate to see which templates your tenant accepts for a language.

# Valid template names for English (United States)
Get-SPOWebTemplate -LocaleId 1033 | Select-Object Name, Title

# Check a site that you created with -NoWait
Get-SPOSite -Identity "https://spguides.sharepoint.com/sites/ProjectCommunication" |
    Select-Object Title, Template, Status

Things that trip people up with New-SPOSite

  • Deleted site with the same URL: the command fails while a deleted site with that URL is still in the SharePoint recycle bin. Restore it or remove it for good first.
  • Group-connected team sites: New-SPOSite does not create the Microsoft 365 group. Use New-PnPSite -Type TeamSite, shown earlier in this tutorial, for that.
  • Old parameters: -CompatibilityLevel no longer has any effect, and -ResourceQuota is deprecated. Leave them out of new scripts.
  • -NoWait: the command returns right away while SharePoint keeps creating the site. Check the Status property with Get-SPOSite before you add content.

Troubleshooting New-PnPSite errors

  • The URL is already in use: another site, or a deleted one, owns that address. Deleted sites stay in the admin center recycle bin for 93 days and still block the URL. Check with the command below, then pick a new URL or restore the old site. New-PnPTenantSite has -RemoveDeletedSite for this case.
  • Access denied or “You do not have permission”: your account isn’t a SharePoint Administrator and user site creation is turned off, or the app lacks full control permissions.
  • The alias is already taken: for TeamSite, the alias must be unique across Microsoft 365 groups. Pick another one or reuse the existing group.
  • Owner errors in app-only scripts: app-only connections have no signed-in user, so add -Owner or -Owners.
  • The script continues before the site is ready: add -Wait before running cmdlets such as creating a SharePoint list with PnP PowerShell against the new site.
Get-PnPTenantDeletedSite -Identity "https://contoso.sharepoint.com/sites/ContosoMarketing"

Created a test site by mistake? Deleting a SharePoint site moves it to the recycle bin, so you can still restore it.

Want to automate site creation in other ways? These guides pick up where this one ends:

Frequently Asked Questions

How do I create a SharePoint Online site using PnP PowerShell?

Connect with Connect-PnPOnline and your own app’s client ID, then run New-PnPSite with -Type CommunicationSite, TeamSite or TeamSiteWithoutMicrosoft365Group plus a title and a URL (or an alias for a group-connected team site).

What is the difference between New-PnPSite and New-PnPTenantSite?

New-PnPSite creates modern communication and team sites and can create the Microsoft 365 group. New-PnPTenantSite is admin-only, takes a template ID, numeric time zone and storage quota, and never creates a group. The New-PnPSite reference lists every parameter.

Do I need to be a SharePoint admin to create a site with PnP PowerShell?

Not always. Regular users can create sites with PnP PowerShell if the Users can create SharePoint sites setting is on, as Microsoft explains in Manage site creation in SharePoint. New-PnPTenantSite always needs admin access.

How do I set the language and time zone when creating a site?

Use -Lcid (for example 1033 for English, United States) and -TimeZone with a value such as UTCMINUS0500_EASTERN_TIME_US_AND_CANADA. The language can’t be changed after the site is created.

How long does New-PnPSite take to create a site?

A communication site in my tenant was ready in about 4 seconds. Group-connected team sites usually take longer. Add -Wait when the next commands in your script need the site fully provisioned.