/errors/purview/retention-policy-stuck-in-pendingdeletion
Retention policy stuck in PendingDeletion: Remove-RetentionCompliancePolicy -ForceDeletion
- tool
- Microsoft Purview (Security & Compliance PowerShell)
- versions
- Microsoft Purview, ExchangeOnlineManagement 3.x
- os
- any
A Microsoft Purview retention policy that stays in PendingDeletion after you deleted it has a deletion that failed: Microsoft's troubleshooting article attributes it to an unspecified error during the removal. The documented fix is to connect to Security & Compliance PowerShell and remove the policy again with the -ForceDeletion switch.
Connect-IPPSSession -UserPrincipalName admin@contoso.com
Remove-RetentionCompliancePolicy -Identity "Finance retention" -ForceDeletionConnect-IPPSSession comes from the ExchangeOnlineManagement module; the account needs a Purview role that can manage retention (for example Compliance Administrator). The retention cmdlets do not exist until that connection is made.
Check the state before and after
Get-RetentionCompliancePolicy -Identity "Finance retention" | Select-Object Name, Mode, DistributionStatus, Enabled, RestrictiveRetentionRun it again after -ForceDeletion: when the policy is gone, Get-RetentionCompliancePolicy no longer returns it. The cmdlet reference describes -ForceDeletion only as forcing the removal of the policy; it does not change what the policy retained.
Before forcing deletion
- Preservation Lock: with
-RestrictiveRetention $true, the cmdlet reference states that no one, including an administrator, can turn off the policy or make it less restrictive. CheckRestrictiveRetentionon the policy before trying to delete it. - Policies for Teams private channels and Viva Engage: these are app retention policies, managed with the
*-AppRetentionCompliancePolicycmdlets rather thanRemove-RetentionCompliancePolicy.
Related distribution errors
If the policy is not being deleted but shows an error in the portal (for example "We couldn't find this location"), see We couldn't find this location (FailedToOpenContainer), which also lists the other portal messages and their PowerShell values.
Sources
- learn.microsoft.comlearn.microsoft.com/en-us/troubleshoot/microsoft-365/purview/retention/resolve-errors-in-retention-and-retention-label-policies
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/exchangepowershell/remove-retentioncompliancepolicy
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/exchange/connect-to-scc-powershell