Offboard a Departing User in Microsoft 365 and Microsoft Entra ID
Microsoft's own offboarding series runs in a fixed order: stop sign-in, save mailbox content, wipe or block mobile devices, forward or convert the mailbox, hand OneDrive and Outlook data to someone else, remove the license, and only then delete the account (Remove a former employee (opens in a new tab)). The order matters because several later steps (shared mailbox, forwarding, OneDrive access) need the account to still exist.
Use it when: a planned departure, a contractor ending, or a same-day termination. For a suspected compromise, start with Cut off a compromised or departing user now, then come back here for data handling.
Before you start
- Roles: User Administrator or Helpdesk Administrator can reset passwords and sign out standard users; signing out other administrators needs Global Administrator (Step 1 prerequisites (opens in a new tab)). Disabling accounts takes User Administrator for non-admins or Privileged Authentication Administrator for admin accounts; disabling devices takes at least Cloud Device Administrator (Revoke user access (opens in a new tab)). Removing licenses: License Administrator or User Administrator (Step 6 (opens in a new tab)). OneDrive access handover uses a SharePoint admin (Step 5 (opens in a new tab)).
- Hybrid users: if the account syncs from on-premises Active Directory, disable it and reset the password there; Microsoft recommends resetting it twice to reduce pass-the-hash risk (Revoke user access, hybrid (opens in a new tab)). Synced users must also be deleted and restored on-premises, not in Microsoft 365 (Remove a former employee (opens in a new tab)).
- Holds: before you remove a license you must remove all holds for the user; if the mailbox must stay searchable for legal reasons it needs Exchange Online Plan 2 (or Plan 1 plus Exchange Online Archiving) so a hold can be applied before deletion (Step 6 (opens in a new tab)).
Step by step
- Run the read-only snapshot below and save the CSV. It records licenses, groups and registered devices before anything changes.
- Stop sign-in. In the Microsoft Entra admin center, go to Entra ID > Users > All users, select the user, Account status > Edit, clear Account enabled, Save, then select Revoke sessions on the Overview page (Revoke user access (opens in a new tab)). In the Microsoft 365 admin center the equivalent is Users > Active users > Reset password, then Account > Sign out of all sessions, then Block sign-in (Step 1 (opens in a new tab)).
- Disable their devices if they used company devices registered to them (the Graph sample on the revoke page uses
Get-MgUserRegisteredDevicethenUpdate-MgDevice -AccountEnabled:$false). For Intune-managed phones and laptops, decide wipe vs retire: see Wipe or retire an Intune device. - Decide what happens to the mailbox. Either convert it to a shared mailbox (keeps existing mail and calendar) or forward new mail to a colleague. Forwarding only sends new mail (Step 4 (opens in a new tab)). To convert: Users > Active users > the user > Mail > Convert to shared mailbox. The mailbox must still be licensed when you convert (Convert a user mailbox (opens in a new tab)). Details in Shared mailboxes.
- Cancel their meetings, especially ones that booked rooms or equipment, which stay unavailable until cancelled (Step 4, Cancel Outlook meetings (opens in a new tab)).
- Hand over OneDrive. Users > Active users > the user > OneDrive > Create link to files gives you access to copy what's needed. Only the latest version of a file is moved (Step 5 (opens in a new tab)). Check that the user's manager is set: by default the manager automatically gets access to the OneDrive when the user is deleted (OneDrive retention and deletion (opens in a new tab)).
- Remove the license on Licenses and Apps, then reduce the license count under Billing > Your products if you won't refill the seat (Step 6 (opens in a new tab)). Skip this if the mailbox is a shared mailbox over 50 GB, which still needs a license.
- Delete the account last, and only if you didn't convert the mailbox or set up forwarding. Both need the account as an anchor (Step 4 (opens in a new tab)).
Read-only PowerShell snapshot
Read-only. Module: Microsoft.Graph.Users. Scopes: User.Read.All (user properties, licenses, group membership, registered devices). Run before step 2. Not tested against a live tenant.
Connect-MgGraph -Scopes "User.Read.All"
$upn = "leaver@contoso.com"
$user = Get-MgUser -UserId $upn -Property "id,displayName,userPrincipalName,accountEnabled,onPremisesSyncEnabled,assignedLicenses,manager" -ExpandProperty manager
$groups = Get-MgUserMemberOf -UserId $user.Id -All
$devices = Get-MgUserRegisteredDevice -UserId $user.Id -All
[pscustomobject]@{
UPN = $user.UserPrincipalName
Enabled = $user.AccountEnabled
Synced = $user.OnPremisesSyncEnabled
Manager = $user.Manager.AdditionalProperties.userPrincipalName
LicenseSkuIds = ($user.AssignedLicenses.SkuId -join '; ')
Groups = ($groups | ForEach-Object { $_.AdditionalProperties.displayName }) -join '; '
Devices = ($devices | ForEach-Object { $_.AdditionalProperties.displayName }) -join '; '
} | Export-Csv ".\offboard-$($user.Id).csv" -NoTypeInformation
User.Read is listed as least privileged for the memberOf and registeredDevices APIs only when you query yourself; reading another user needs User.Read.All or higher (List memberOf (opens in a new tab), List registeredDevices (opens in a new tab)). With limited permissions, some directory objects come back with only their @odata.type, so blank names in the CSV can be a permissions gap, not a missing object.
Gotchas
- Sign-out isn't instant. Access tokens last about an hour by default, so apps using them keep working until the token expires; apps with their own session cookies may not send the user back to Microsoft Entra ID at all (When access is revoked (opens in a new tab)). Outlook on the web may not sign out until the user refreshes or opens another app (Step 1 (opens in a new tab)).
- Learn gives different timings for blocking. Step 1 says blocking sign-in in the Microsoft 365 admin center can take up to 24 hours and to reset the password for immediate effect; Step 7's table lists about 30 minutes via the Exchange admin center or PowerShell, 60 minutes via the Microsoft Entra admin center, and 3 hours or more on-premises (Step 7 (opens in a new tab)). Do the password reset and the block together.
- A converted mailbox still accepts the old password unless you reset it (Convert a user mailbox (opens in a new tab)). Keep sign-in blocked.
- Removing the license starts a clock. Email, contacts and calendar are kept for 30 days after the license is removed, then permanently deleted (Step 6 (opens in a new tab)). Convert or export first.
- Unlicensed OneDrive accounts are archived. OneDrives without a valid license are archived on their 93rd unlicensed day (OneDrive retention and deletion (opens in a new tab)). Step 5 of the offboarding series says OneDrive content stays accessible after 30 days if you remove the license but keep the account; these two pages describe the unlicensed state differently, so don't treat a license-removed account as long-term storage.
- Mailboxes inactive for compliance reasons can't be forwarded or converted (Step 4 (opens in a new tab)).
Check it worked
- The user shows Account enabled: No, and a fresh sign-in attempt fails with a disabled-account error (AADSTS50057).
- The shared mailbox or forward works, and the manager or delegate can open the OneDrive link.
- The license appears as available under Billing > Licenses.
Roll back
Re-enable Account enabled and reassign the license. A deleted user can be restored for about 30 days, with OneDrive and Outlook content (Step 5 overview table (opens in a new tab), Restore a user). A shared mailbox can be converted back to a regular mailbox from the Exchange admin center (Recipients > Mailboxes > the mailbox > Others > Convert to regular mailbox), then license the account and reset the password (Convert back (opens in a new tab)).
Related on EntraReady: Shared mailboxes, Find and clean up inactive user accounts, Clean up stale devices, Cut off a compromised or departing user now.
← All GuidesIs this still accurate?
Spotted something outdated or wrong on this page? Tell us in a sentence. The page address is sent with it.