Create a Modern Site Collection in SharePoint Online using PowerShell

Requirement: Create a modern site collection SharePoint Online PowerShell

How to create a Modern Team Site in SharePoint Online?

SharePoint Online modern sites provide a whole new user experience by their intuitive design, responsive UI optimized for mobile devices, and faster page loading. By default, when you create a site in the SharePoint Online admin center, it creates a modern team with an associated Office 365 group. How to create a modern site collection in SharePoint Online? Well, To create a modern SharePoint Online Site collection, follow these steps:

  • Login to New SharePoint Admin Center as a tenant admin or SharePoint Online Administrator. 
  • Click on Sites >> Active Sites from left navigation >>
    Click on “Create”
  • Click on “Team site” to create a modern team site in SharePoint Online.
    create modern site collection sharepoint online powershell
  • Provide the site Name, URL, Group owner options and click on “Finish” to create a modern site collection in SharePoint Online.
    sharepoint online create modern team site powershell
  • To set Privacy settings and language you can expand “Advanced Settings” and set the site’s privacy whether it’s a private site or public site accessible to everyone in the organization. Then, click the Next button.
    sharepoint online create private site collection

Wait for a moment and your site collection should appear in the site collections list. BTW, You can create a new site collection from the SharePoint Online start page as well (https://<tenant> Now, let’s see how to create a modern team site without a group in
SharePoint Online using PowerShell.

SharePoint Online: Create Modern Team Site Collection using PowerShell

The SharePoint Online PowerShell cmdlets are a great way to automate your day-to-day tasks. You can create site collections, move site collections, or provision sites in bulk with ease. It is an incredibly powerful tool that will allow you to do more in less time. Here, in this case, You can create a modern site collection in SharePoint Online by specifying the site template as “STS#3”:

#Connect to SharePoint Online
Connect-SPOService -url "" -Credential (Get-credential)
#Create a modern team site
New-SPOSite -Url "" -Owner "[email protected]" -StorageQuota 2048 -Title "Purchase Team Site" -Template "STS#3"

Create Modern Site Collection in SharePoint Online using PowerShell

SharePoint modern team sites allow you to share information with your team in the organization. You can use a team site to store and collaborate on files and manage lists of information. To create a modern team site using PowerShell in SharePoint Online:

#PowerShell to create modern site collection
Function Create-SPOSite
        [string]$Title  = $(throw "Please Provide the Site Title!"),
        [string]$URL = $(throw "Please Provide the Site URL!"),
        [string]$Owner = $(throw "Please Provide the Site Owner!"),
        [int]$StorageQuota = $(throw "Please Provide the Site Storage Quota!")
#Connection parameters 
$AdminURL = ""
$AdminName = "[email protected]"
    #Connect to Office 365
    Connect-SPOService -Url $AdminURL -Credential (Get-Credential)
    #Check if the site collection exists already
    $SiteExists = Get-SPOSite | Where {$_.URL -eq $URL}
    #Check if the site exists in the recycle bin
    $SiteExistsInRecycleBin = Get-SPODeletedSite | where {$_.url -eq $URL}
    If($SiteExists -ne $null)
        write-host "Site $($url) exists already!" -foregroundcolor Yellow
    elseIf($SiteExistsInRecycleBin -ne $null)
        write-host "Site $($url) exists in the recycle bin!" -foregroundcolor Yellow
        #sharepoint online create modern site collection powershell
        New-SPOSite -Url $URL -title $Title -Owner $Owner -StorageQuota $StorageQuota -NoWait -ResourceQuota $ResourceQuota -Template $Template
        write-host "Site Collection $($url) Created Successfully!" -foregroundcolor Green
catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
#Parameters to create new site collection
$SiteTitle = "Purchase"
$SiteURL= ""
$SiteOwner = "[email protected]"
$StorageQuota = 2048
$SiteTemplate = "STS#3"
#Call The function to create site collection
Create-SPOSite -Title $SiteTitle -URL $SiteURL -Owner $SiteOwner -StorageQuota $StorageQuota -Template $SiteTemplate

PnP PowerShell to Create Modern Site

If you want to create a modern site collection with Office 365 group, use New-PnPSite cmdlet of  PnP PowerShell in SharePoint Online.

New-PnPSite -Type TeamSite -Title "Test Modern TeamSite" -Alias TestModernTeamSite -IsPublic

Let’s wrap it inside a function and add some error handling to PnP PowerShell script to create a modern site:

#Define Variables
$AdminCenterURL = ""
$SiteURL = ""
$SiteTitle = "crescent Procurement Portal"
$SiteOwner = "[email protected]"
$Template = "STS#3" #Modern Team Site
$Timezone = 24 #GMT+4
#Get Credentials to connect
$Cred = Get-Credential
    #Connect to Tenant Admin
    Connect-PnPOnline -URL $AdminCenterURL -Credential $Cred
    #Check if site exists already
    $Site = Get-PnPTenantSite | Where {$_.Url -eq $SiteURL}
    If ($Site -eq $null)
        #sharepoint online pnp powershell create site collection
        New-PnPTenantSite -Url $SiteURL -Owner $SiteOwner -Title $SiteTitle -Template $Template -TimeZone $TimeZone -RemoveDeletedSite
        write-host "Site Collection $($SiteURL) Created Successfully!" -foregroundcolor Green
        write-host "Site $($SiteURL) exists already!" -foregroundcolor Yellow
Catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red

How to create a modern site without a group? SharePoint Online: Create Modern Team Site without Group

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply