Problem
You might have received the below error when you try to connect your SharePoint Online site using Connect-SPOService cmdlet.
Connect-SPOService : Current site is not a tenant administration site. At line:1 char:1 + Connect-SPOService -Url https://TenantName.sharepoint.com/sites/SiteName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Connect-SPOService], ServerException + FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.Conne ctSPOService
Fix/Soution
The URL parameter of the Connect-SPOService cmdlet accepts only the url of SharePoint Online Administration Center site. To work with any of your site using SharePoint Online PowerShell module, you have to first establish a connection with SPO tenant site which is the admin site of your SharePoint tenant in Office 365, once this connection is established you can access any SPOSite using Get-SPOSite cmdlet.
Connect-SPOService -Url https://TenantName-admin.sharepoint.com
Once you connected your Admin site, you can get your required SPO site details using the below command.
Get-SPOSite -Identity https://TenantName.sharepoint.com/sites/SiteName
You can set required details in SPO site using the below command
Set-SPOSite -Identity https://TenantName.sharepoint.com/sites/SiteName -Owner [email protected] -NoWait
For more details read How to Connect SharePoint Online PowerShell Module.
We were providing the credentials of my Office 365 account but still, It was giving the error. And the Office 365 account which we were using is an Office 365 tenant administrator account. So there were no issues regarding permission. But still, current site is not a tenant administration site error was coming.