Fix “Get-SPOSite : The managed path Sites/URL is not a managed path in this tenant.” Error in SharePoint Online

Problem: Getting “Get-SPOSite: The managed path sites/URL is not a managed path in this tenant.” error in PowerShell.

Get-SPOSite: The managed path sites-URL is not a managed path in this tenant.

Solution: 

A simple PowerShell script to get a site collection in SharePoint Online gave this error message. After a while, I noticed the error was because of the “/” character at the end of the $SiteURL parameter. It should be just the site URL without “/” at the end! So, the below PowerShell script works fine! (https://Crescent.sharepoint.com/sites/Marketing works, but https://Crescent.sharepoint.com/sites/Marketing/ doesn’t.)

#Parameters
$AdminCenterURL = "https://Crescent-admin.sharepoint.com"
$SiteURL = "https://Crescent.sharepoint.com/sites/Marketing/"

#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Get Site Collection
$Site = Get-SPOSite -Identity $SiteURL

This error also occurs when you provide a subsite URL, document library, or list URL instead of a site collection URL for the Get-SPOSite cmdlet. In other words, The Get-SPOSite or Set-SPOSite cmdlets can only be used to get a top-level site collection, and it fails when you pass it with the URL of a subsite or list.

However, If you try the PnP PowerShell, Get-PnPTenantSite is able to get the site collection even if the site URL has a trailing / (slash) character in it.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Fix “Get-SPOSite : The managed path Sites/URL is not a managed path in this tenant.” Error in SharePoint Online

  • Sharepointdiary to the rescue again…thanks!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *