How to Permanently Delete an Exchange Online Mailbox
Question details
A Microsoft 365 administrator needs to permanently delete an Exchange Online mailbox while retaining the associated user account for other services.

- Product
- Exchange Online
- Device & OS
- not provided
- Scenario
- Managing Microsoft 365 licenses and mailboxes for cloud-only and synchronized hybrid user accounts.
- Observed behavior
- The administrator requires a method to permanently purge a mailbox and clear previous mailbox info via PowerShell without removing the underlying Active Directory or Microsoft 365 user account.
Ensure you have the Exchange Online PowerShell module installed and possess global administrator or Exchange administrator privileges. Verify your environment type, as the process for cloud-only accounts differs significantly from hybrid environments.
Permanently Delete Mailbox for Cloud-Only and Synchronized Accounts
Use this method to permanently clear mailbox information for accounts that are fully managed in the cloud or synchronized without an active hybrid Exchange environment.
This process requires you to first remove the user's Exchange Online license so the mailbox enters a soft-deleted state. Once soft-deleted, you can permanently purge the mailbox using PowerShell.
Warning: This action is permanent and cannot be undone. All emails, calendar items, and contacts in the mailbox will be permanently destroyed.
Log in to the Microsoft 365 Admin Center, navigate to 'Users' > 'Active users', select the specific user account, and uncheck their Exchange Online license under the 'Licenses and apps' tab. Save the changes.
Allow up to 30 minutes for the Microsoft 365 system to process the license removal. The mailbox will automatically transition into a soft-deleted state.
Open Windows PowerShell as an administrator and execute the command 'Connect-ExchangeOnline' to securely authenticate with your Microsoft 365 tenant.
Run the command 'Set-User "user@example.com" -PermanentlyClearPreviousMailboxInfo' (replacing the email address with the target user's UPN). This command permanently purges the mailbox while keeping the user account intact for services like Teams or OneDrive.

Handling Mailbox Deletions in a Hybrid Exchange Environment
Use on-premises tools to manage mailboxes when your Microsoft 365 environment is synchronized with a local Exchange Server.
Empower Your Team with WPS Office
While you manage complex Microsoft 365 backend environments like Exchange Online, consider offering your organization a lightweight, highly compatible alternative for their daily document processing needs. WPS Office provides professional-grade tools for text documents, spreadsheets, and presentations without the heavy overhead.

Frequently Asked Questions
Can I undo the PermanentClearPreviousMailboxInfo command?
No. Once you run the -PermanentlyClearPreviousMailboxInfo parameter, the mailbox and all its contents are permanently purged from Microsoft's servers. It cannot be recovered from the recycle bin or via eDiscovery.
What happens if I just remove the license without running the PowerShell command?
If you only remove the Exchange Online license, the mailbox enters a 'soft-deleted' state. It will be retained in the system for 30 days by default, during which it can be fully recovered by reassigning the license, before being permanently deleted automatically.
Will deleting the Exchange mailbox break the user's Microsoft Teams access?
The user will still be able to sign in to Microsoft Teams as long as their Azure AD account remains active and they have a Teams license. However, features that rely on Exchange, such as calendar syncing, scheduling meetings, and accessing voicemail, will be severely degraded or unavailable.
Why am I getting an error running Set-User in my hybrid setup?
In hybrid environments, user attributes are authoritative on-premises. If you attempt to manipulate the mailbox state directly in Exchange Online, Microsoft 365 will block it to prevent directory sync conflicts. You must manage the mailbox via your on-premises Exchange Management Shell using commands like Disable-RemoteMailbox.




