Skip to content

/errors/purview/retention-policy-stuck-in-pendingdeletion

Retention policy stuck in PendingDeletion: Remove-RetentionCompliancePolicy -ForceDeletion

The commands on this page have not been executed by our verification runner yet.updated
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.

powershell
Connect-IPPSSession -UserPrincipalName admin@contoso.com
Remove-RetentionCompliancePolicy -Identity "Finance retention" -ForceDeletion

Connect-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

powershell
Get-RetentionCompliancePolicy -Identity "Finance retention" | Select-Object Name, Mode, DistributionStatus, Enabled, RestrictiveRetention

Run 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. Check RestrictiveRetention on the policy before trying to delete it.
  • Policies for Teams private channels and Viva Engage: these are app retention policies, managed with the *-AppRetentionCompliancePolicy cmdlets rather than Remove-RetentionCompliancePolicy.

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