SharePoint Online Management Shell
SharePoint Online Management Shell is the PowerShell module that Microsoft provides which gives you access to high-level administrative functions. If you're accustomed to working in SharePoint on-premises, this is basically the subset of the function from central administration that is permitted in Office 365.
This module allows you to perform those administrative tasks that are above the level of a site collection administrator, such as creating a new site collection. Anything at a lower level will require another approach.
But before you can add a site collection or change the sharing permission, you'll need to connect. Here's how to accomplish that:
Import-Module Microsoft.Online.SharePoint.PowerShell
$TenantName = "my365tenant"
$sharePointUri = "https://$TenantName-admin.sharepoint.com"
# Use these if connecting using delegated admin privs
## $DelegateName = "$TenantName.onmicrosoft.com"
## $sharePointUri = "$sharePointUri?DelegatedOrg=$DelegateName"
Write-Host -ForegroundColor Cyan "Connecting to SharePoint Online"
Write-Host $sharePointUri
Connect-SPOService -Verbose <#:$VerbosePreference #> -Url $sharePointUri
-Credential $Credentials
Much like our previous examples, if you haven't specified a value for $Credentials, you'll be prompted to enter a username and password. However, unlike other modules for Office 365, the SharePoint Management Shell does not use remote PowerShell sessions.
Here's the output from the commands shown previously:
Once you're connected, you're free to use any of the commands from the SharePoint module. If you're not sure what they are, you can use Get-Command like so to show a list of available commands:
Get-Command -Module Microsoft.Online.SharePoint.PowerShell