Microsoft Team Site – Get-SPOSite: The site SITEURL is not properly formed

When using a Get-SPOSite or Set-SPOSite on a Microsoft Teams , Modern Group SharePoint Online URL, One Drive for Business etc., you may get one of the following error messages

Get-SPOSite : The site https://customer.sharepoint.com/sites/Parent/Secondary/Secondary is not properly formed.

OR

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

The "The site SITEURL is not properly formed" error message may be encountered under the following scenarios

  • Using a URL with a trailing slash "/"
  • Using a URL from a secondary site collection instead of a parent collection
  • Using a URL from a secondary site collection with a trailing slash "/"

In order to Get or Set the Team site properties, which can be a child site, shorten the URL path until you find the parent path

e.g.

  • Set-SPOSite - identity https://customer.sharepoint.com/sites/Parent/Secondary/Secondary. -Error
  • Set-SPOSite - identity https://customer.sharepoint.com/sites/Parent/Secondary - Error
  • Set-SPOSite - identity https://customer.sharepoint.com/sites/Parent - Success