Microsoft 365 Error Codes

Fix the Get-SPODeletedSite URL Error in SharePoint Online

Jason MillerJason Miller Nov 25, 2026 868 views

Question details

The user needs to resolve a malformed site URL error when using SharePoint Online deleted-site PowerShell commands.

Fix the Get-SPODeletedSite URL Error in SharePoint Online
Product
SharePoint Online Management Shell
Device & OS
not provided
Scenario
An administrator is retrieving or removing a deleted SharePoint Online site collection with PowerShell.
Observed behavior
Get-SPODeletedSite or Remove-SPODeletedSite reports that the site is not properly formed when the site collection URL is incorrect or incomplete.
Before you start

Make sure the SharePoint Online Management Shell is available and that you have an account with the necessary SharePoint administrator permissions. Identify your tenant name and the deleted site's expected path before connecting.

Solution 1Recommended

Verify and use the full deleted site collection URL

Use the exact URL returned by SharePoint to avoid passing an incomplete or incorrect site address to the commands.

1
Connect to the tenant

Open the SharePoint Online Management Shell and run Connect-SPOService -Url "https://tenant-admin.sharepoint.com", replacing tenant with your tenant name. Sign in when prompted.

2
Find the deleted site

Run Get-SPODeletedSite to list deleted sites. Find the intended site and copy its full URL from the output.

3
Check the URL format

Verify that the copied URL includes https://, the correct tenant, and the complete site path. Common examples are https://tenant.sharepoint.com/sites/site-name and https://tenant.sharepoint.com/teams/site-name.

4
Retrieve the exact site

Run Get-SPODeletedSite -Identity "https://tenant.sharepoint.com/sites/site-name", replacing the example with the exact URL you copied.

5
Remove only if intended

After confirming the returned site is correct, run Remove-SPODeletedSite -Identity "https://tenant.sharepoint.com/sites/site-name" only if you intend to permanently remove it, and follow the confirmation prompt.

Verify and use the full deleted site collection URL
Permanent removal: Remove-SPODeletedSite permanently removes the deleted site collection. Confirm that you do not need to restore it before proceeding.
Free Microsoft Office alternative

Work with Office documents using WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and support for common Microsoft Office formats, making it easier to move existing documents into your workflow. It does not manage SharePoint Online sites or fix SharePoint PowerShell errors.

Open and edit Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTX.Use familiar document, spreadsheet, and presentation tools in one lightweight suite.Continue working with Office documents while administering SharePoint separately.Move existing compatible Office files into WPS Office without starting from scratch.
microsoft office alternative - wps office

Frequently Asked Questions

Which URL should I use with Get-SPODeletedSite?

Use the full deleted site collection URL, such as https://tenant.sharepoint.com/sites/site-name. Run Get-SPODeletedSite without an identity to find and copy the URL returned for the site.

Should I use the SharePoint admin URL as the site identity?

No. Use https://tenant-admin.sharepoint.com with Connect-SPOService, then use the deleted site's own URL with the -Identity parameter of Get-SPODeletedSite or Remove-SPODeletedSite.

Does Remove-SPODeletedSite permanently delete the site?

Yes. Remove-SPODeletedSite permanently removes the deleted site collection. First use Get-SPODeletedSite -Identity with the full URL to confirm you have selected the intended site.

What if SharePoint displays different capitalization in the site URL?

The reported capitalization may differ from what you entered without affecting functionality. Use the exact URL returned by Get-SPODeletedSite when querying or removing the deleted site; changing letter case is not a substitute for verifying the tenant and full path.