--- title: "Identify Departed Employees and Reclaim Microsoft 365 Licenses" slug: "dex-wf-reclaim-licenses-departed-employees" updated: 2026-11-30T16:11:31Z published: 2026-11-30T16:11:31Z canonical: "documentation.sysaid.com/dex-wf-reclaim-licenses-departed-employees" --- > ## Documentation Index > Fetch the complete documentation index at: https://documentation.sysaid.com/llms.txt > Use this file to discover all available pages before exploring further. # Identify Departed Employees and Reclaim Microsoft 365 Licenses Find disabled accounts still consuming licenses and free them up to reduce billing. **Complexity:** Intermediate. **Impact:** cost-savings + license-hygiene + offboarding + compliance. ## Why use this workflow Departed employees often leave behind active Microsoft 365 licenses even after their accounts are disabled. Every unclaimed license continues to bill against your tenant until it is explicitly unassigned. For tenants with dozens to thousands of users, these orphaned assignments can add up quickly. This workflow walks you through systematically identifying departed employees, using a combination of disabled-account state, recent audit log activity, and HR-provided lists, and reclaiming their licenses so they can be reassigned or dropped from your subscription at renewal. Run this monthly as part of your license hygiene cadence, or on demand when HR notifies IT of terminations. ## Expected outcomes - A list of all disabled user accounts that still hold Microsoft 365 license assignments - Cross-referenced audit log data showing when each account was disabled and by whom - Licenses removed from departed employees and returned to the available pool - A documented report suitable for finance or audit review - Lower ongoing license costs at the next billing cycle ## Risks and considerations ### Before you reclaim - **Preserve mailbox and OneDrive data first.** Removing a license can delete the mailbox after 30 days and the OneDrive after retention expires. Convert the mailbox to shared, set a retention hold, or export data before unassigning. - **Disabled does not always mean departed.** Some disabled accounts are on leave, maternity, or awaiting rehire. Confirm departure status with HR before reclaiming. - **Group-based licenses.** If the license is assigned via a group, you must remove the user from the group. Unassigning directly will fail or be re-applied automatically. - **Litigation hold.** Accounts under e-discovery or legal hold must retain their license (or be converted to inactive mailboxes) until the hold is released. ### Compliance Document every reclamation action with timestamps and the approving manager/HR contact. This is often required for SOX, ISO 27001, or SOC 2 access-review controls. ## Required permissions | Permission | Why it's needed | | --- | --- | | User.Read.All | Enumerate all users and read their accountEnabled state and assigned licenses | | Directory.ReadWrite.All | Call assignLicense to remove SKUs from departed users | | AuditLog.Read.All | Query directoryAudits for recent 'Disable account' events to confirm departure timing | | Organization.Read.All | Resolve SKU IDs to friendly product names via subscribedSkus | | Group.Read.All | Detect group-based license assignments that must be resolved at the group level | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` Identify recently departed employees in our Microsoft 365 tenant, reclaim their licenses, and produce a report showing which SKUs were freed. Cross-check disabled accounts against the audit log and flag any that are on legal hold before removing licenses. ``` ## Manual steps (admin center) 1. Sign in to the [Microsoft 365 admin center](https://admin.microsoft.com) as a Global Admin or License Admin. 2. In the left navigation, go to **Users** > **Active users**. 3. Click **Filter** and select **Sign-in blocked** to show disabled accounts. These are your primary candidates for departed employees. 4. Click **Export users** (top toolbar) to download a CSV. Open it in Excel and filter for rows where `Block sign-in` is *Yes* and `Licenses` is non-empty. 5. Cross-reference the list with HR's termination report. Flag confirmed departures. 6. For each confirmed departed employee: - Click the user's name to open their profile. - Go to the **Licenses and apps** tab. - Uncheck every assigned license. - Click **Save changes**. 7. Verify reclamation by returning to **Billing** > **Licenses**. The **Available** count for each SKU should have increased. 8. Optional: convert the user's mailbox to a shared mailbox before removing the Exchange license to preserve email access for the team. ## Microsoft Graph API ### Step 1: Find disabled users with active licenses ``` GET https://graph.microsoft.com/v1.0/users?$filter=accountEnabled eq false&$select=id,displayName,userPrincipalName,assignedLicenses ``` Paginate with `@odata.nextLink` if your tenant has more than 100 disabled users. In the response, keep only users where `assignedLicenses` is non-empty. ### Step 2: Correlate with recent disable events ``` GET https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?$filter=activityDisplayName eq 'Disable account'&$top=50&$orderby=activityDateTime desc ``` This confirms *when* each account was disabled and by whom, which is useful for audit trails. ### Step 3: Resolve SKU IDs to product names ``` GET https://graph.microsoft.com/v1.0/subscribedSkus?$select=skuId,skuPartNumber,consumedUnits,prepaidUnits ``` ### Step 4: Remove licenses from a departed user ``` POST https://graph.microsoft.com/v1.0/users/{user_id}/assignLicense Content-Type: application/json {  "addLicenses": [],  "removeLicenses": ["c42b9cae-ea4f-4ab7-9717-81576235ccac"] } ``` Expected response: `200 OK` with the updated user object. If the license was group-assigned, you'll receive a `400` with `Error: License cannot be removed directly`. Remove the user from the licensing group instead via `DELETE /groups/{group_id}/members/{user_id}/$ref`. ## PowerShell The Microsoft Graph PowerShell SDK is the supported replacement for the retired MSOnline and AzureAD modules. The approach: - Connect with delegated permissions - Enumerate all disabled users with licenses - Output a CSV report for review - Optionally remove licenses, with a dry-run or confirmation step first ### Prerequisites ``` Install-Module Microsoft.Graph -Scope CurrentUser Connect-MgGraph -Scopes "User.Read.All","Directory.ReadWrite.All","AuditLog.Read.All","Organization.Read.All" ``` ### Review before you reclaim Run in report-only mode first. Review the CSV with HR and finance, then remove licenses only after sign-off.