No soft-deleted mailbox after license removal in Office 365

Gilt für: Exchange Online

Symptoms


When you try to perform a mailbox-restore operation to recover the contents of a deleted mailbox in Microsoft Office 365, you can't find a soft-deleted mailbox for the account that was deprovisioned.

Cause


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

Resolution


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.

A screenshot of the Assign License page


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:
  1. Sign in to the Microsoft 365 admin center.
  2. Locate Users > Deleted Users

    A screenshot of the Deleted Users field
  3. Search for the user, and then select the account object.
  4. Select the Restore option.

    Note The user becomes an active user. The Sync Type is now listed as In cloud instead of Synced with Active Directory

    A screenshot of the Sync Type page
  5. Locate Active Users, and then add an Exchange license for the user.
  6. After some minutes, the mailbox becomes active in Exchange.
  7. When you finish the search and export, run the Remove-Mailbox cmdlet 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 Undo-SoftDeletedMailbox cmdlet.