--- title: "Export a Report of All Users and Their Assigned Licenses" slug: "dex-wf-export-users-assigned-licenses-report" updated: 2026-11-30T16:11:48Z published: 2026-11-30T16:11:48Z canonical: "documentation.sysaid.com/dex-wf-export-users-assigned-licenses-report" --- > ## 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. # Export a Report of All Users and Their Assigned Licenses Generate a complete CSV inventory of every Microsoft 365 user with their assigned license SKUs, resolved to friendly product names. **Complexity:** Beginner. **Impact:** read-only + reporting + license-audit + compliance + bulk. ## Why use this workflow License reporting is one of the most common recurring tasks for a Microsoft 365 administrator. Finance wants to reconcile monthly spend, security wants to verify who holds privileged SKUs (E5 Security, P2, etc.), and IT leadership wants to identify unused or overprovisioned licenses before renewal. This workflow produces a full per-user license inventory across the tenant: display name, UPN, and every assigned SKU (translated from GUIDs to human-readable product names like `ENTERPRISEPACK` or `SPE_E5`). Run it whenever you need an audit-ready snapshot, typically before a renewal, during a license true-up, or as part of quarterly access reviews. Microsoft 365 does not expose a single built-in export that joins users with their resolved license names, so admins either click through the GUI one user at a time, use the Licenses blade's limited export, or script against Microsoft Graph. Scripting is the fastest and most repeatable option. ## Expected outcomes ### After running this workflow you will have: - A CSV file (`User_License_Report.csv`) with one row per user containing **Display Name**, **User Principal Name**, **Account Enabled**, and a comma-separated **Licenses** column. - License SKU GUIDs resolved to friendly `skuPartNumber` values (e.g. `ENTERPRISEPACK`, `SPE_E5`, `FLOW_FREE`). - A clear view of unlicensed accounts, useful for spotting guest users, shared mailboxes, room resources, and stale enabled users. - A repeatable approach you can schedule (Task Scheduler / Azure Automation) for monthly reporting. ## Risks and considerations ### Before you run this - **Data sensitivity.** The output contains every user's UPN and license entitlements. Treat the CSV as confidential and store it in a location governed by your DLP / retention policy. - **Read-only scopes only.** This workflow needs `User.Read.All` and `Organization.Read.All`. Do not consent to write scopes (`User.ReadWrite.All`, `Directory.ReadWrite.All`) for a reporting task. - **Guest users are included.** `GET /users` returns members and guests by default. If you only want employees, filter on `userType eq 'Member'`. - **Disabled accounts are included.** Disabled accounts can still hold licenses (common licensing waste). Review before deprovisioning: if you remove a license from a mailbox-enabled user without a grace-period plan, mailbox data can be deleted after 30 days. - **Friendly SKU names are internal codes.** `skuPartNumber` values like `SPE_E5` are Microsoft's internal identifiers. Use Microsoft's [product names and service plan identifiers](https://learn.microsoft.com/en-us/entra/identity/users/licensing-service-plan-reference) reference to translate for non-technical stakeholders. - **Large tenants require paging.** Tenants over 999 users need `@odata.nextLink` handling. `Get-MgUser -All` in PowerShell handles this automatically. ## Required permissions | Permission | Why it's needed | | --- | --- | | User.Read.All | Read every user's profile and assignedLicenses property | | Organization.Read.All | Read tenant subscribedSkus to map SKU GUIDs to skuPartNumber friendly names | | Directory.Read.All | Alternative broader scope if User.Read.All is not available; grants the same read-only view | ## Ask Dex Paste the prompt into a Dex conversation. ### Prompt for IT admins ``` Generate a report of all users in our Microsoft 365 tenant with their assigned licenses. Resolve SKU GUIDs to friendly product names, include whether each account is enabled, and produce a downloadable CSV I can share with finance. ``` ## Manual steps (admin center) The built-in GUI path produces a simpler report (no per-user SKU detail in a single file) but requires no scripting. Use this when you need a quick snapshot or when your account lacks Graph consent rights. ### Option A: Licenses page (per-SKU view) 1. Sign in to the [Microsoft 365 admin center](https://admin.microsoft.com) with a Global Reader, License Administrator, or Global Administrator account. 2. Go to **Billing** > **Licenses**. 3. Click a product (e.g. *Microsoft 365 E3*) to open the SKU detail page. 4. Select the **Assigned licenses** tab. 5. Click **Export users** (top of list) to download a CSV of users holding that SKU. 6. Repeat for each SKU you care about. Merge the CSVs in Excel if you need a unified view. ### Option B: Active users export (all users, limited license detail) 1. Go to **Users** > **Active users**. 2. Click **Export users** at the top of the list. 3. Confirm the export. A CSV is downloaded with columns including `DisplayName`, `UserPrincipalName`, and `Licenses` (semicolon-separated SKU part numbers). 4. Open in Excel and filter/pivot as needed. **Limitations of the GUI path:** Option A requires multiple exports and manual merge. Option B gives one file but the `Licenses` column uses friendly names that differ slightly from Graph's `skuPartNumber`, and there is no filter for disabled users or guests. For any serious reporting, use the API or PowerShell path below. ## Microsoft Graph API Two calls are needed: one to list users with their `assignedLicenses`, and one to get the tenant's SKU catalog so you can translate GUIDs to names. ### 1. Get all users with assigned licenses ``` GET https://graph.microsoft.com/v1.0/users?$select=id,displayName,userPrincipalName,accountEnabled,assignedLicenses&$top=999 Authorization: Bearer {access_token} ``` Response (abbreviated): ``` {  "@odata.context": "...",  "@odata.nextLink": "https://graph.microsoft.com/v1.0/users?$skiptoken=...",  "value": [    {      "id": "b6d7d5f3-...",      "displayName": "Jane Doe",      "userPrincipalName": "jane@contoso.com",      "accountEnabled": true,      "assignedLicenses": [        { "disabledPlans": [], "skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900" }      ]    }  ] } ``` **Paging:** If `@odata.nextLink` is present in the response, follow it until it is absent. Tenants with more than 999 users will have multiple pages. ### 2. Get the tenant SKU catalog ``` GET https://graph.microsoft.com/v1.0/subscribedSkus Authorization: Bearer {access_token} ``` Response: ``` {  "value": [    {      "skuId": "6fd2c87f-b296-42f0-b197-1e91e994b900",      "skuPartNumber": "ENTERPRISEPACK",      "prepaidUnits": { "enabled": 100 },      "consumedUnits": 87    }  ] } ``` ### 3. Join in your client Build a dictionary of `skuId` to `skuPartNumber` from call 2, then iterate call 1's users and translate each `assignedLicenses[].skuId`. Emit a CSV row per user. ### Alternative: per-user license detail If you need service-plan-level detail (which sub-features are enabled/disabled), call `GET /v1.0/users/{id}/licenseDetails` per user. This is one request per user, so use it only when you need service plan information. ## PowerShell This approach uses the official [Microsoft.Graph](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation) PowerShell module. It handles paging, resolves SKU GUIDs to friendly names, and exports a CSV. ### Prerequisites 1. Install the module (once per machine): ``` Install-Module Microsoft.Graph -Scope CurrentUser ``` 2. Connect with read-only scopes: ``` Connect-MgGraph -Scopes "User.Read.All","Organization.Read.All" ``` ### Approach - Pull all users with `Get-MgUser -All` (automatic paging). - Pull the SKU catalog with `Get-MgSubscribedSku`. - Build a hashtable to translate each `SkuId` into a `SkuPartNumber`. - Emit one row per user with comma-joined license names. - Write `User_License_Report.csv` to the current directory.