Deleting a SharePoint Online Site Using PowerShell

This Microsoft SharePoint Online blog post will show how to delete a SharePoint site using PowerShell.

In some use cases, like deleting a Microsoft Teams channel site, we must use the SharePoint Online PowerShell module. Sometimes, we can use PowerShell to delete multiple sites at once.

Note: Before using the code, ensure the SharePoint Online PowerShell module is installed.

Deleting a SharePoint Online Site Using PowerShell

The following code will connect to SharePoint Online, using MFA and delete a site. In the $siteurl variable, add the site URL you need to delete and add your tenant name to the connect command.

# Site to delete
$siteurl = “https://SITEURL”

# Connecto to SharePoint using MFA
connect-sposervice -url “”

# Delete site
remove-sposite -Identity $siteurl -Nowait -confirm:$false

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.