SharePoint Online team focusing on Microsoft Graph API to provide a common API experience for Office 365 users, but for some Admin-related activities still we need to use the PowerShell module. Follow the below steps to install and connect SharePoint Management Shell.
- Download SharePoint Online Management Shell
- Run the installer
- Once you have installed the downloaded setup, run the below command to load this module
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Note: If the PowerShell console is already opened, close and open the PowerShell again after installing the above setup.
- Now run the following command after replacing your tenant name to connect SPO service. Actually, you have to set your SPO admin site URL, you can refer to this post for more info: how to get SharePoint Online Admin Site Url
Connect-SPOService -url "https://<your tenant name>-admin.sharepoint.com"
- Once you have connected the SPO service, then you can run SPO management commands. The below command lists all SPO sites.
Get-SPOSite | Select Title, Url
Advertisement
Please note, as of dec 2020, the Microsoft.Online.SharePoint.PowerShell still does not run on PowerShell 7.x; it only runs on Windows Powershell.
This is important to know: over the last years, many e-books and instructive video’s suggest that you should stop using Windows PowerShell. However, since many modules still rely on .net, you can only use Windows powershell.