SOLVED

What's the recommended way to completely remove a modern teamsite?

Iron Contributor

Hello,

 

I'd like to get your point of view on the "correct" way on how to remove a modern teamsite.

 

The reason I'm asking is because once I remove an Office 365 group, either via O365 admin center

or PowerShell (Remove-PnPUnifiedGroup), the site collection will not be removed with it.

 

In a peculiar way the site collection will be locked and I'm getting a 403 forbidden error.

I expect that if provisioning an O365 group creates a modern team site, removing th group should also lead to the removal of the site collection.

 

Any points of view here?

Thanks.

 

 

4 Replies
When you remove a Group, it's not permanently deleted....is just soft-deleted and it stays in that state for 30 days
The way to permenatley delete a group is in this article. https://support.office.com/en-us/article/Restore-a-deleted-Office-365-Group-b7c66b59-657a-4e1a-8aa0-...

Sometimes this won't delete the SharePoint site, so you can do powershell to see if the site existings using get-sposite command in the SHarePoint Online powershell module. Then if so, you might need to unlock then delete the site manually.

Some folks have success just deleting the group out of soft delete. Others still have to remove the SPO Site after doing so.

Thanks for your replies.

 

I successfully tried the manual PowerShell way but had to unlock the site collection first, as you mentioned.

 

When you say "[...]deleting the group out of soft delete." How can you do that? A "Remove-PnPUnifiedGroup" and "Remove-Mailbox" in PowerShell doesn't seem to be enough?


Thanks.

best response confirmed by Olf (Iron Contributor)
Solution
This is what I have in my notes that I use:

Sometimes you may want to permanently purge a group without waiting the 30 days for the soft-delete to expire. To do that start PowerShell and run this command to get the object ID of the group
Get-AzureADMSDeletedGroup
Take note of the object ID of the group, or groups, you want to permanently delete.
CAUTION: Purging the group removes the group and its data forever. 
To purge the group run this command in PowerShell
Remove-AzureADMSDeletedDirectoryObject –Id <objectId>
To confirm that the group has been successfully purged, run the Get-AzureADMSDeletedGroup cmdlet again to confirm that the group no longer appears on the list of soft-deleted groups. In some cases it may take as long as 24 hours for the group and all of its data to be permanently deleted.

From <https://support.office.com/en-us/article/Restore-a-deleted-Office-365-Group-b7c66b59-657a-4e1a-8aa0-...>
1 best response

Accepted Solutions
best response confirmed by Olf (Iron Contributor)
Solution
This is what I have in my notes that I use:

Sometimes you may want to permanently purge a group without waiting the 30 days for the soft-delete to expire. To do that start PowerShell and run this command to get the object ID of the group
Get-AzureADMSDeletedGroup
Take note of the object ID of the group, or groups, you want to permanently delete.
CAUTION: Purging the group removes the group and its data forever. 
To purge the group run this command in PowerShell
Remove-AzureADMSDeletedDirectoryObject –Id <objectId>
To confirm that the group has been successfully purged, run the Get-AzureADMSDeletedGroup cmdlet again to confirm that the group no longer appears on the list of soft-deleted groups. In some cases it may take as long as 24 hours for the group and all of its data to be permanently deleted.

From <https://support.office.com/en-us/article/Restore-a-deleted-Office-365-Group-b7c66b59-657a-4e1a-8aa0-...>

View solution in original post