I recently wanted to administer my sharepoint online sites using Powershell. I installed Sharepoint Online Management shell and then used the command Connect-SPOService.
Connect-SPOService -url https://mylab000.sharepoint.com/ whereas the URL given in the end of the Command line is the URL of one of my Sharepoint online site.
|connect-sposervice : Current site is not a tenant administration site.|
At line:1 char:1
connect-sposervice -url https://mylab000.sharepoint.com
FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.Conne
To Fix this issue, Instead of using sharepoint site URL. You will need to use the Sharepoint Online admin center URL to connect. Replace the Sharepoint Site URL with Sharepoint admin URL and then try again with the same command. To get the admin URL you will need to follow below steps:
- Login on Microsoft 365 Admin Center using administrator credentials.
- Click on Sharepoint Under Admin Centers.
- Next step is to check the address bar of the browser to find the Sharepoint Online Admin URL. Use this URL for connecting to the Sharepoint online from Powershell using Connect-SPOService. Notice that this URL contains admin in the name of the URL.
Now try to connect to the Sharepoint Online site and use the commands e.g. get-sposite to verify the connection.