How to delete an inactive mailbox in Microsoft 365?
+
Once you no longer require the contents of an inactive mailbox, you can permanently delete the mailbox by removing all holds on it. Subsequently, the inactive mailbox is automatically flagged for deletion and will be permanently removed after processing.
Before removing the holds, you must identify the type of hold placed on an Exchange Online mailbox. You can identify them by running the below cmdlets in your Exchange Online PowerShell.
Get-Mailbox -Identity <IdentityofInactiveMailbox> -InactiveMailboxOnly | FL DisplayName,Name,DistinguishedName,ExchangeGuid,IsInactiveMailbox,LitigationHoldEnabled,LitigationHoldDuration,LitigationHoldDate,LitigationHoldOwner,InPlaceHolds,ComplianceTagHoldApplied
Run the below PowerShell cmdlet to remove an inactive mailbox from a retention policy that is configured at the organization level.
Set-Mailbox <Identity of inactive mailbox> -ExcludeFromOrgHolds <Retention policy GUID without prefix or suffix>
You can also remove an inactive mailbox from all the retention policies configured at the organization level.
Set-Mailbox <Identity of inactive mailbox> -ExcludeFromAllOrgHolds
Run the below PowerShell cmdlet to remove an inactive mailbox from a retention policy configured for specific mailboxes.
Set-RetentionCompliancePolicy -Identity <Retention policy GUID without prefix or suffix> -RemoveExchangeLocation <Identity of inactive mailbox>
Run the below PowerShell cmdlet to remove a Litigation hold from an inactive mailbox.
Set-Mailbox -InactiveMailbox -Identity <Identity of inactive mailbox> -LitigationHoldEnabled $false
After removing the holds or retention policies on an inactive mailbox, it is considered a soft-deleted mailbox and is marked for permanent deletion after 30 days.