This Microsoft Purview blog post will show how to exclude a Microsoft 365 Group SharePoint Site from a retention policy.
If your organization has Microsoft Purview retention policies for Microsoft 365 groups (which include SharePoint teams sites) and you try to delete a SharePoint site that is part of the group, you won’t be able to do so.
Microsoft Purview retention policies allow organizations to apply retention policies that retain Microsoft 365 data for many years. To delete a resource that is part of the policy, we need to exclude it.
Exclude Microsoft 365 and SharePoint Team Site
Open the Microsoft Purview admin centre to exclude a SharePoint site from a retention policy.
Click on Policies
Under Data, click on Retention
Select the retention policy that is enabled on your Microsoft 365 workloads.
From the Edit menu, click on
Click edit on the line of Microsoft 365 Group mailboxes & Sites
Select the group you need to exclude and click on Done.
Once excluded, wait for an hour and try to delete the SharePoint site.