Get-SPOsite the managed path is not a managed path in this tenant

In this SharePoint tutorial, we will discuss how to fix error get-sposite the managed path is not a managed path in this tenant which comes while working with PowerShell.

The error also comes as get-sposite the managed path sites/ is not a managed path in this tenant.

get-sposite the managed path is not a managed path in this tenant

Recently, I was trying to remove SharePoint Online Site Collection Administrator using PowerShell by using the below script.

Connect-SPOService -url "https://tsinfo-admin.sharepoint.com/" -credential (Get-Credential)
$sitecollection = Get-SPOSite "https://tsinfo.sharepoint.com/sites/SPFxTraining/"
Set-SPOUser -site $sitecollection -LoginName "bhawana@tsinfo.onmicrosoft.com" -IsSiteCollectionAdmin $False

When I run the above script in PowerShell ISE, it gave the below error:

Get-SPOSite : The managed path sites/SPFxTraining is not a managed path in this tenant.
At line:2 char:19

  • … ollection = Get-SPOSite “https://tsinfo.sharepoint.com/sites/SPFxTrai …
  • ~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [Get-SPOSite], ServerException
    • FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.GetSite

Set-SPOUser : Cannot bind argument to parameter ‘Site’ because it is null.
At line:3 char:19

  • Set-SPOUser -site $sitecollection -LoginName “bhawana@tsinfo.onmicros …
  • ~~~
    • CategoryInfo : InvalidData: (:) [Set-SPOUser], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.Online.SharePoint.PowerShell.SetSPOUser

The error looks like below:

get-sposite the managed path is not a managed path in this tenant

The issue was coming because of the “/” in the site URL, so I removed the slash from the site URL and it worked fine for me.

Connect-SPOService -url "https://tsinfo-admin.sharepoint.com/" -credential (Get-Credential)
$sitecollection = Get-SPOSite "https://tsinfo.sharepoint.com/sites/SPFxTraining"
Set-SPOUser -site $sitecollection -LoginName "bhawana@tsinfo.onmicrosoft.com" -IsSiteCollectionAdmin $False

You may like following PowerShell tutorials:

In this tutorial, we learned how to fix error get-sposite the managed path sites/ is not a managed path in this tenant which comes while working with PowerShell.

>