The SharePoint Online Management Shell is Microsoft’s classic administration module. It mainly covers tenant administration: creating sites, tenant settings, sharing policies. For working inside sites — lists, files and metadata — PnP PowerShell is more practical. In practice you use both.
Installing
Install-Module Microsoft.Online.SharePoint.PowerShell -Scope CurrentUserThis module was originally built for Windows PowerShell 5.1. If you run PowerShell 7, load it in compatibility mode:
Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShellConnecting
You always connect to your tenant’s admin URL, not to a regular site:
Connect-SPOService -Url https://contoso-admin.sharepoint.comA sign-in window opens; MFA is supported. Then check that it works:
Get-SPOSite -Limit 10Disconnect with:
Disconnect-SPOServiceWhich module for what?
Rule of thumb: tenant-wide settings and site administration with the Management Shell, anything content-related with PnP PowerShell. You don’t have to choose, but knowing where a cmdlet belongs saves a lot of searching.
Frequent errors and how to fix them
These are the messages people type into search when the module will not start. The exact wording is here so this page can be found.
The term 'Connect-SPOService' is not recognized- SharePoint Online Management Shell / Microsoft.Online.SharePoint.PowerShell is not installed, or you are in PowerShell 7 without the module.
403 Forbidden on Connect-SPOService- Not a SharePoint admin, or you are not using the tenant-admin URL (https://CONTOSO-admin.sharepoint.com).
PnP vs SharePoint Online Management Shell- Connect-SPOService is the classic module; Connect-PnPOnline is PnP. Do not mix them in one script.
Questions about this, or need help setting it up? We are happy to think along.
Message on LinkedIn →