To create a site collection with PowerShell in an O365 tenant you need to specify the site template ID (eg. BDR#0), nothing new here if you’re familiar with creating site collections via PowerShell in a SharePoint on-premises farm.
The templates in SharePoint Online are dependent on your tenant’s O365 license. To view your tenant’s site template IDs, connect to your tenant from a SharePoint Online Management shell and enter cmdlet Get-SPOWebTemplate. Here is what’s available in an E3 tenant as of August 2016:
Note: Don’t be fooled by the PRODUCTCATALOG#0 template showing in the above list of templates in an E3 tenant. In SharePoint Server this template is used for cross-site publishing and although not required it has many of the components pre-configured for you. I’ve read numerous blog posts stating this template was not available in SharePoint Online (it is not an option thru the GUI) so imagine my surprise when I saw it in the list of available templates when entering the Get-SPOWebTemplate PowerShell cmdlet. Being curious, I had to try creating a site collection with that template but it displayed this message in the SharePoint Admin Center Site Collection list beside the site collection as follows:
I was still hopeful that it would eventually be created, but even after 24 hours the message continues. Perhaps this is something that will come to SharePoint Online in the future, but as of August 2016 it does not work.
Once you know the template ID, you can create your site collection using the New-SPOSite cmdlet. (TechNet link)
[code language=”powershell” light=”true”]
New-SPOSite -Url https://somecompany.sharepoint.com/sites/teamsite -Owner firstname.lastname@example.org -StorageQuota 100 -ResourceQuota 50 -Template STS#0
The list of template IDs available in SharePoint Online is significantly shorter than what is available in an on-premises SharePoint environment. My go-to post for quickly viewing site template IDs for an on-premises farm is from Vlad Catrinescu (@vladcatrinescu) titled SharePoint 2013 Site Template ID list. Alternatively you can use the Get-SPWebTemplate PowerShell cmdlet.
Thanks for reading!