Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Can't open a leaver's mailbox after removing their Microsoft 365 licence: the 30-day window and what to do first

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

If you remove the Exchange Online licence from a user whose mailbox has no hold, Exchange Online disconnects the mailbox at once. You cannot open it. Microsoft's remedy: reassign an Exchange Online licence within 30 days from when it was removed. "After 30 days, Exchange Online permanently deletes the mailbox, and the mailbox becomes unrecoverable."

If the mailbox does have a hold, the removal fails with an error and the mailbox stays active, which is a different problem with a different fix. Both are covered below, with the steps to take before removing a licence.

What the error means

Microsoft's page, "Can't access the mailbox of an unlicensed user in Exchange Online", describes the symptom: you "can't locate the mailbox." It is not listed in the Exchange admin center or in the output of these cmdlets:

Get-Mailbox -Identity ayla@contoso.com.au -SoftDeletedMailbox
Get-Mailbox -Identity ayla@contoso.com.au -IncludeInactive

The cause: "For a regular user mailbox in Exchange Online that doesn't have a hold applied, Exchange Online immediately disconnects (disables) the mailbox if the Exchange Online license for the user is removed or expires. You can't access a disconnected mailbox." Microsoft's former-employee page agrees: when you remove or delete a licence, "the former employee's email, contacts, and calendar are retained for 30 days, and are then deleted permanently."

The hybrid note: "if a cloud user that's synced from on-premises becomes unsynced, Exchange Online deletes the user. If the deleted user is unlicensed, you must restore the deleted user before you can reassign their Exchange Online license."

Likely causes

The causes below are the reasons the mailbox cannot be reached.

Cause What you see How to confirm
Licence removed, no hold Mailbox disconnected immediately; not in the admin centre or soft-deleted list Reassign a licence inside 30 days and test
Licence removed, mailbox on hold Error in the admin centre: "Exchange: An unknown error has occurred. Refer to the correlation ID"; mailbox stays active; Entra changes don't sync ServiceProvisioningErrors on the user, via Graph
User account deleted Mailbox soft-deleted for 30 days. Microsoft's deletion page says that if the licence was removed before the user left the recycle bin, the mailbox does not become soft-deleted Get-Mailbox -SoftDeletedMailbox lists it, except in that licence-removed case, where it shows nothing
More than 30 days passed Mailbox gone for good Microsoft: permanently deleted and unrecoverable
Unsynced hybrid user User deleted by Exchange Online The user must be restored before a licence can be reassigned

Prove the cause before changing anything

  1. Note the date and time the licence was removed. Count 30 days from it.
  2. Run the two Get-Mailbox commands above. If neither lists the mailbox, check the date first.
  3. If the removal produced an error, list user accounts with provisioning errors. Microsoft gives three commands for this, the first of which installs a module.

Save first: before running anything, check whether the module is already on that computer, using the form shown on Microsoft's Uninstall-Module page with the module name replaced, and keep the output:

Get-InstalledModule -Name Microsoft.Graph

Risk: the first of Microsoft's three commands below installs a module for all users on that computer, and installing may add further Microsoft.Graph modules with it. Back-out: if the listing above showed nothing, you can remove what you added with Uninstall-Module -Name Microsoft.Graph (the form on Microsoft's page, with a module name). That page does not say it also removes modules the install pulled in, so check what remains and remove only modules you know were absent before. If the module was already installed, there is nothing to undo. You can avoid the install entirely: Microsoft's page says the error also shows on the Account tab of the user's flyout in the Microsoft 365 admin center. The other two commands only read.

Install-Module Microsoft.Graph -Scope AllUsers -Repository PSGallery -Force
Connect-MgGraph -Scopes User.Read.All
Get-MgBetaUser -All | Select-Object -Property UserPrincipalName -ExpandProperty ServiceProvisioningErrors | FL UserPrincipalName, AdditionalProperties

Check the ErrorDescription value of AdditionalProperties for each user. Microsoft's example shows that Exchange Online "can't disable a mailbox that has a litigation hold."

Fix

No hold: reconnect within 30 days. Reassign an Exchange Online licence to the user, as Microsoft says. Save first: note the date, the user and which licence was removed.

Disruptive step: assigning the licence restores sign-in and mail flow to that account. Impact: if the person has left, they can sign in again, so block sign-in first (Microsoft's former-employee page lists preventing sign-in as its Step 1). Back-out: remove the licence again. Microsoft's page gives the 30-day rule counted from when the licence was removed, and does not say whether a second removal starts a new 30 days, so note both dates and do not rely on a new window.

If the user was deleted rather than unlicensed, restore the account. Microsoft's mailbox deletion page says "We strongly recommend restoring the mailbox from the same source (Microsoft Entra ID or Exchange Online) from where the user or mailbox was deleted. Failing to do so will result in a failed restore operation." The mailbox-level command for a soft-deleted mailbox follows the steps below.

Select the right object first. Run Get-Mailbox -SoftDeletedMailbox (the form used above), keep the output, and note the alias shown there for the person you mean.

Disruptive step: the command below makes the soft-deleted mailbox an active mailbox again, and mail for that address starts to be delivered to it. Back-out: Microsoft's pages describe no command that undoes the restore, so confirm the alias against the saved listing before you run it.

In the command, florencef is Microsoft's sample alias; replace it with the alias you noted:

Undo-SoftDeletedMailbox -SoftDeletedObject florencef

With a hold: choose preserve or delete. Microsoft says the first step is to reassign the licence to resolve the error; the next steps must be done while the account is licensed.

  • Preserve the content. For a cloud account, delete the user account; for a synced account, delete the on-premises account, move it to an organisational unit that does not sync, or set an attribute that stops it syncing. Exchange Online then unassigns the licence and starts converting the mailbox to an inactive mailbox, finalised when the account is permanently deleted after 30 days. Microsoft says inactive mailboxes "preserve email content and don't require a user license after they're created."
  • Delete the content. Identify and remove the holds, remove the resulting delay hold, then unassign the licence. Exchange Online disconnects the mailbox and "permanently deletes the mailbox after 30 days, or after 60 days if you enabled Delicensing Resiliency."

Identify first, and change nothing yet: write down the user, the holds found on the mailbox, and the owner's written decision to preserve or to delete. Do not go further until all three are on record.

Save first, for either route: export what you need through Content Search or a copy, and confirm the legal position with whoever owns it.

Disruptive step, preserve route: delete the cloud user account (or, for a synced account, remove it from sync as Microsoft lists). Impact: the user is deleted, the licence returns to the pool, and the mailbox starts converting to an inactive mailbox, finalised when the account is permanently deleted. Back-out: Microsoft says the deleted account is removed after 30 days "unless you restore it", so restore it within 30 days from the Deleted users list in the Microsoft 365 admin center, where Microsoft's page says the deleted account is listed, and reassign a licence; after that there is no way back. For a synced account that was only removed from sync, undo the change you made (move it back to the syncing organisational unit, or remove the attribute you set), then reassign a licence.

Disruptive step, delete route: remove the holds, the resulting delay hold and then the licence. Impact: it ends the legal reason to keep the content, and the mailbox is permanently deleted after 30 days, or 60 with Delicensing Resiliency. Back-out: within that period reassign a licence as for the no-hold case; Microsoft's page gives no way to put a removed hold back, so re-apply holds only from your saved record of them.

Do first, for a leaver whose mail you want kept. Microsoft's former-employee page puts saving the mailbox before removing the licence. Two documented routes:

  • Convert to a shared mailbox. "The user mailbox needs a license assigned to it before you convert it." Without a licence a shared mailbox is limited to 50 GB, "You might need to delete a bunch of large messages", and "Don't delete the old user's account, because the account is required to anchor the shared mailbox." Check the current page for limits.

    Save first: note the mailbox size and which licence is assigned. Disruptive step: convert in the Microsoft 365 admin center (Users, Active users, Mail tab, Convert to shared mailbox). Impact: the mailbox becomes shared, and if the original sign-in details are not reset they keep working on it, as Microsoft's page says. Back-out, per Microsoft's page: in the Exchange admin center select Recipients, Mailboxes, the shared mailbox, then on the Others tab Convert to regular mailbox, and Confirm. Then, in the Microsoft 365 admin center, choose the user account under Users, assign a licence to the account and reset the password. Without the licence, a regular mailbox is disconnected, as described at the start.

  • Delicensing Resiliency. Microsoft describes it as the capability "to delay the operation of Exchange Online license removal by 30 days". It is available only to "tenants with over 5000 non-trial licenses", and can take 24 to 48 hours to turn on; check the current page, because these terms can change.

    Save first: read the current state with Get-OrganizationConfig | fl *DelayedDelicensingEnabledState*. Disruptive step: Set-OrganizationConfig -DelayedDelicensingEnabled:$true. Impact: it is a tenant-wide setting that changes how every licence removal behaves. Back-out: Microsoft's page gives Set-OrganizationConfig -DelayedDelicensingEnabled:$false; users already in the 30-day period finish that period.

Inactive mailbox, planned in advance. Microsoft's inactive mailbox page says "Making a mailbox inactive requires a hold on the mailbox, and then deleting the mailbox or corresponding user account." To keep the content indefinitely, its table gives three steps: apply Microsoft 365 retention settings with retain actions to the mailbox, wait for the retention settings to be applied, then remove the user's Microsoft 365 account. Microsoft says that to create an inactive mailbox "it must be licensed correctly so that a hold can be applied to the mailbox before it's deleted." Removing the licence before the hold is in place leaves a mailbox with no hold, which Exchange Online disconnects at once, as described at the start.

Save first: record the user and the retention policy you intend to apply, and the owner's written decision to keep the content. Disruptive step: the last step of Microsoft's table, removing the user's Microsoft 365 account. Impact: the mailbox becomes inactive, and the account is permanently removed after 30 days unless restored. Back-out: restore the deleted account within 30 days from the Deleted users list in the Microsoft 365 admin center; after that there is no way back. Do not start that step until the retention settings are confirmed applied.

Confirm the fix

For a reconnected mailbox, sign in as the user or open it from an admin account and confirm mail is present, then check Get-Mailbox returns it. For a shared mailbox, check members can open it and that its size is under 50 GB. For an inactive mailbox, the Purview listing and Get-Mailbox -InactiveMailboxOnly -ResultSize Unlimited | FT DisplayName,PrimarySMTPAddress,WhenSoftDeleted show it.

Example (illustrative): the licence of ayla@contoso.com.au is removed on 3 November 2026. Thirty days later is 3 December 2026 (27 days to 30 November, then 3 more). On 28 November the owner notices the mailbox is gone, which leaves 5 days (28 November to 3 December). The administrator reassigns the licence on 28 November and the mailbox returns. Had the owner waited until 4 December, it would be unrecoverable.

What to watch afterwards

  • Add a step to the leaver checklist: convert, forward or hold before removing the licence.
  • Put the 30-day date in the leaver ticket at the moment the licence is removed.
  • Look for accounts with provisioning errors after each leaver round.
  • If Delicensing Resiliency is available to you, confirm its status with the Get-OrganizationConfig command on Microsoft's page.

Risks and limits

These commands have not been run or lab-tested. Microsoft's pages on this fault do not cover a mailbox that is part of a retention policy only, and the delicensing page says the 30-day grace period "may extend up to 60-days during tenant re-location process". Microsoft's mailbox deletion page shows a date of 2023-10-26; check the current page. The 50 GB shared mailbox limit and the 5000-licence condition for Delicensing Resiliency are licence and limit terms; check the current pages for them too.

Microsoft's mailbox deletion page lists Remove-Mailbox -PermanentlyDelete among its deletion scenarios. Do not run Remove-Mailbox -PermanentlyDelete or purge the user from the recycle bin as a way of tidying up. Permanent deletion cannot be undone. Do not delete a leaver's account before deciding about their mailbox and OneDrive.

Sources