Leaver Report

Drop the Entra snapshot you took before offboarding and the one you took after. You get a ticket attachment listing which group memberships, directory roles and licenses were removed, added, and still remain.

Files are read in this tab only. Nothing is uploaded or saved.

Before snapshot

Captured before you started offboarding.

No file chosen

After snapshot

Captured after you finished.

No file chosen

Add both snapshots to compare.

Your ticket attachment appears here

Add a Before and an After snapshot of the same user. The comparison runs as soon as both files check out.

How to capture a snapshot

How to capture a snapshot (PowerShell)

Run this read-only recipe in an existing Microsoft Graph PowerShell session, once before you start offboarding and once after. Use the same tenant and the same user object ID both times. This page never runs it and never sees your credentials.

Copy steps 1–5 in order into the same session. Set a different local output path for each capture.

  1. 1. Set the user

    Reading another user by object ID requires delegated User.Read.All. Use a work or school account authorized to read the user in this tenant.

    $UserObjectId = '<user object GUID>'
    $OutputPath = './before.json'
    
    function Get-SnapshotPage($Uri) {
        $target = [uri]$Uri
        if ($target.GetLeftPart([UriPartial]::Authority) -ne 'https://graph.microsoft.com' -or
            -not $target.AbsolutePath.StartsWith('/v1.0/', [StringComparison]::Ordinal)) {
            throw 'Expected a Microsoft Graph v1.0 URL.'
        }
        Invoke-MgGraphRequest -Method GET -Uri $Uri -OutputType Hashtable -ErrorAction Stop
    }
    
    function Get-SnapshotCollection($Uri) {
        do {
            $page = Get-SnapshotPage $Uri
            if (-not $page.Contains('value') -or $page.value -isnot [array]) {
                throw 'Graph did not return a collection page.'
            }
            foreach ($item in $page.value) { $item }
            $Uri = $page.'@odata.nextLink'
        } while ($Uri)
    }
    
    function Test-SnapshotLine($Value) {
        $Value -is [string] -and
            -not [string]::IsNullOrWhiteSpace($Value) -and
            $Value -notmatch '[\p{Cc}\p{Zl}\p{Zp}\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]'
    }
    
    function Add-SnapshotLabel($Entry, $Value) {
        if (Test-SnapshotLine $Value) { $Entry.label = $Value }
        $Entry
    }
  2. 2. Read groups

    User.Read.All permits reading the user’s direct memberships. GroupMember.Read.All provides basic group properties such as display names. Hidden memberships require Member.Read.Hidden where applicable.

    function Get-SnapshotGroups($Base, $Id) {
        $seen = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
        foreach ($group in (Get-SnapshotCollection "$Base/users/$Id/memberOf")) {
            if ($group.'@odata.type' -ne '#microsoft.graph.group') { continue }
            $groupId = ([guid]$group.id).ToString()
            if ($seen.Add($groupId)) {
                Add-SnapshotLabel @{ id = $groupId } $group.displayName
            }
        }
    }
  3. 3. Read role assignments

    RoleManagement.Read.Directory permits reading directory role assignments and role definitions. The signed-in account also needs a supported Entra role or equivalent custom role permissions for these reads, such as Directory Readers.

    function Get-SnapshotRoles($Base, $Id) {
        $filter = [uri]::EscapeDataString("principalId eq '$Id'")
        $uri = $Base + '/roleManagement/directory/roleAssignments?$filter=' + $filter
        $seen = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
        $names = @{}
        $guidPath = '(?i)(^|/)[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}(?=/|$)'
        foreach ($role in (Get-SnapshotCollection $uri)) {
            $definition = ([guid]$role.roleDefinitionId).ToString()
            $directory = $role.directoryScopeId
            $app = $role.appScopeId
            if (($null -eq $directory -and $null -eq $app) -or
                ($null -ne $directory -and -not (Test-SnapshotLine $directory)) -or
                ($null -ne $app -and -not (Test-SnapshotLine $app))) {
                throw 'Graph returned a role assignment with an invalid scope.'
            }
            if ($null -ne $directory) {
                $directory = [regex]::Replace($directory, $guidPath, { param($m) $m.Value.ToLowerInvariant() })
            }
            $key = ConvertTo-Json -InputObject @($definition, $directory, $app) -Compress
            if (-not $seen.Add($key)) { continue }
            if (-not $names.ContainsKey($definition)) {
                $names[$definition] = $null
                try {
                    $name = Get-SnapshotPage "$Base/roleManagement/directory/roleDefinitions/$definition"
                    $names[$definition] = $name.displayName
                } catch {
                    # A name lookup is optional. Keep the assignment.
                }
            }
            Add-SnapshotLabel @{
                roleDefinitionId = $definition
                directoryScopeId = $directory
                appScopeId = $app
            } $names[$definition]
        }
    }
  4. 4. Read licenses

    LicenseAssignment.Read.All permits reading the user’s license details. The signed-in account also needs a supported Entra role or equivalent custom role permissions for this read, such as Directory Readers.

    function Get-SnapshotLicenses($Base, $Id) {
        $seen = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
        foreach ($license in (Get-SnapshotCollection "$Base/users/$Id/licenseDetails")) {
            $sku = ([guid]$license.skuId).ToString()
            if ($seen.Add($sku)) {
                Add-SnapshotLabel @{ skuId = $sku } $license.skuPartNumber
            }
        }
    }
  5. 5. Write the snapshot

    No additional Graph access is needed. This step reads the user, completes all three paginated reads and then writes the snapshot to the local path you chose.

    & {
        $ErrorActionPreference = 'Stop'
        $base = 'https://graph.microsoft.com/v1.0'
        $context = Get-MgContext
        if (-not $context.TenantId) { throw 'Connect to the tenant with Microsoft Graph PowerShell first.' }
        $tenant = ([guid]$context.TenantId).ToString()
        $id = ([guid]$UserObjectId).ToString()
        $user = Get-SnapshotPage "$base/users/$id"
        if (([guid]$user.id).ToString() -ne $id) { throw 'Graph returned a different user.' }
    
        $groups = @(Get-SnapshotGroups $base $id)
        $roles = @(Get-SnapshotRoles $base $id)
        $licenses = @(Get-SnapshotLicenses $base $id)
        $snapshot = [ordered]@{
            version = 1
            tenantId = $tenant
            userId = $id
            capturedAt = [DateTime]::UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'", [Globalization.CultureInfo]::InvariantCulture)
            groups = $groups
            roles = $roles
            licenses = $licenses
        }
        $json = ConvertTo-Json -InputObject $snapshot -Depth 6
        $utf8 = [System.Text.UTF8Encoding]::new($false, $true)
        if ($utf8.GetByteCount($json) -gt 2MB) { throw 'Snapshot exceeds the 2 MiB limit.' }
        $path = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($OutputPath)
        [System.IO.File]::WriteAllText($path, $json, $utf8)
    }

Synthetic example

These use made-up IDs. Save them as files and drop them above to see a full report without a tenant.

before.json

{
  "version": 1,
  "tenantId": "aa000000-0000-0000-0000-000000000001",
  "userId": "bb000000-0000-0000-0000-000000000001",
  "capturedAt": "2026-11-30T09:12:04.000Z",
  "groups": [
    {
      "id": "ab000000-0000-0000-0000-000000000004",
      "label": "VPN Users"
    },
    {
      "id": "ab000000-0000-0000-0000-000000000001",
      "label": "All Staff"
    },
    {
      "id": "ab000000-0000-0000-0000-000000000002",
      "label": "Finance – AP"
    },
    {
      "id": "ab000000-0000-0000-0000-000000000003",
      "label": "Teams: Falcon Workspace"
    }
  ],
  "roles": [
    {
      "roleDefinitionId": "bc000000-0000-0000-0000-000000000002",
      "directoryScopeId": "/administrativeUnits/DD000000-0000-0000-0000-000000000001",
      "appScopeId": null,
      "label": "User Administrator"
    },
    {
      "roleDefinitionId": "bc000000-0000-0000-0000-000000000001",
      "directoryScopeId": "/",
      "appScopeId": null,
      "label": "Global Reader"
    },
    {
      "roleDefinitionId": "bc000000-0000-0000-0000-000000000002",
      "directoryScopeId": "/",
      "appScopeId": null,
      "label": "User Administrator"
    }
  ],
  "licenses": [
    {
      "skuId": "cd000000-0000-0000-0000-000000000002",
      "label": "EMS"
    },
    {
      "skuId": "cd000000-0000-0000-0000-000000000001",
      "label": "ENTERPRISEPREMIUM"
    }
  ]
}

after.json

{
  "version": 1,
  "tenantId": "AA000000-0000-0000-0000-000000000001",
  "userId": "bb000000-0000-0000-0000-000000000001",
  "capturedAt": "2026-11-30T09:47:31.000Z",
  "groups": [
    {
      "id": "AB000000-0000-0000-0000-000000000003",
      "label": "Teams: Project Falcon"
    },
    {
      "id": "ab000000-0000-0000-0000-000000000005",
      "label": "Shared Mailbox – Finance Archive"
    }
  ],
  "roles": [
    {
      "roleDefinitionId": "bc000000-0000-0000-0000-000000000001",
      "directoryScopeId": "/",
      "appScopeId": null,
      "label": "Global Reader"
    }
  ],
  "licenses": [
    {
      "skuId": "cd000000-0000-0000-0000-000000000003"
    }
  ]
}

See it work

The report shows remaining Teams access and a Global Reader role alongside a newly added shared-mailbox group.
The report shows remaining Teams access and a Global Reader role alongside a newly added shared-mailbox group.
The page identifies the reversed snapshots and tells you to select the earlier file as Before.
The page identifies the reversed snapshots and tells you to select the earlier file as Before.
On a phone the tally puts remaining access first, above the Markdown download and group comparison.
On a phone the tally puts remaining access first, above the Markdown download and group comparison.

More pictures, and how Leaver Report works