In my previous
bolg, I have specified, how to create SharePoint Online site collection through UI.
PowerShell also allows you to create site collections in SharePoint Online with the command New-SPOSite. Using PowerShell to create a SharePoint Online Site Collection is very similar to the on-premises version of the SharePoint cmdlets, with very few minor exceptions.
To create a SharePoint Online Site Collection we use the New-SPOSite cmdlet, passing in the required -URL, -Owner and -Storage Quota parameters. The required -StorageQuota parameter is one of the differences between this cmdlet and the equivalent New-SPSite cmdlet for SharePoint On -premise.
Following are the few simple steps to create the site collection in SharePoint Online
Step 1: Open SharePoint Online Management Shell.
SharePoint Online is using different PowerShell tool than regular SharePoint command prompt. Run SharePoint Online Management Shell as an administrator to execute the PowerShell script for SharePoint Online.
Step 2: Connect to SharePoint online services.
This initial connection is necessary to establish a connection context which stores the URL of the tenant administration site and the credentials used to connect to the site. To establish the connection use the Connect-SPOService cmdlet.
$credential = Get-credential
Connect-SPOService -url https://[yoursite]-admin.sharepoint.com -Credential $credential
Step 3: Create the new SharePoint Online Site Collection.
New-SPOSite -Url https:// [yoursite].sharepoint.com/sites/[New Site name] -Owner [your@id].onmicrosoft.com -StorageQuota 1024 -Title "Site Name" -CompatibilityLevel 15 -LocaleID 1033 -ResourceQuota 300 -Template "STS#0" -NoWait
Step 3: Close the connection.
Disconnect-SPOService