No soft-deleted mailbox after license removal in Microsoft 365
Original KB number: 3158794
When you try to perform a mailbox-restore operation to recover the contents of a deleted mailbox in Microsoft 365, you can't find a soft-deleted mailbox for the account that was deprovisioned.
Currently, removing the license leaves the mailbox in a hard-deleted state. Therefore, the mailbox is not displayed as either Soft Deleted or Inactive. The following command is specific to removing the license in PowerShell:
Set-MSOLUserLicense -UserPrincipalName "<Account>" -RemoveLicenses
This may leave the mailbox in a disabled state that prevents it from being displayed as either Soft Deleted or Inactive. In this situation, the following commands won't find the mailbox:
Get-Mailbox <Account> -SoftDeletedMailbox Get-Mailbox <Account> -IncludeInactive
When the license is removed from a mailbox without following other deprovisioning steps, this may leave the mailbox in a hard-deleted state. In order to recover the mailbox, the user must relicense the Azure user object. That will reconnect the mailbox as long as it's within 30 days from the disconnect date.
If the on-premises account no longer exists and is not listed in the Active Users section of the Microsoft 365 admin center, and the account was deleted less than 30 days earlier, follow these steps:
Sign in to the Microsoft 365 admin center.
Locate Users > Deleted Users.
Search for the user, and then select the account object.
Select the Restore option.
The user becomes an active user. The Sync Type is now listed as In cloud instead of Synced with Active Directory.
Locate Active Users, and then add an Exchange license for the user.
After some minutes, the mailbox becomes active in Exchange.
When you finish the search and export, run the
Remove-Mailboxcmdlet to change the object to a soft-deleted mailbox. The soft-deleted mailbox will be available for 30 days. It can be returned to an active state by using the