Support
 
Phone Live Chat
 
Support
 
US: +1 888 720 9500
 
Intl: +1 925 924 9500
Aus: +1 800 631 268
UK: 0800 028 6590
CN: +86 400 660 8680

Direct Inward Dialing: +1 408 916 9393

 
 
 
 
 

How to generate a Microsoft 365 license report

Generate a Microsoft 365 license usage report showing how many licenses each subscription holds, how many are assigned, and who holds them. Use the Microsoft 365 admin center, Microsoft Graph PowerShell, or ManageEngine ADManager Plus.

 
  • Microsoft 365 admin center
  • PowerShell
  • ADManager Plus
  • Why ADManager Plus
  • Real-world use cases
  • FAQ
  • Troubleshooting
 

How to generate a Microsoft 365 license usage report using the Microsoft 365 admin center

Prerequisites for generating a Microsoft 365 license usage report via the Microsoft 365 admin center

  • Permissions: Sign in as a Global Administrator, or with a role that grants access to the pages below, such as License Administrator or Billing Administrator for Billing > Licenses and Reports Reader for Reports > Usage.
  • Tools: A web browser. No other tools or setup are required.

How to generate a Microsoft 365 license usage report using the Microsoft 365 admin center

  1. Sign in to the Microsoft 365 admin center at admin.microsoft.com.
  2. Go to Billing > Licenses and open the Subscriptions tab. Note the available and assigned licenses for each subscription.
  3. Go to Users > Active users to review licensed and unlicensed users.
  4. Go to Reports > Usage. On the Active users card, click View more to see which licensed services each user is active in. This report shows service activity, not license counts.
  5. Click Export to download the report data as a CSV file.

Limitations for generating a Microsoft 365 license usage report via the Microsoft 365 admin center

  • License counts, licensed users, and service activity sit on three different pages, so a combined view means collecting data from each one by hand.
  • Reports > Usage measures service activity and does not show how much of each purchased subscription is consumed.
  • Every export is a manual download from the page it comes from.

How to generate a Microsoft 365 license usage report using PowerShell

Prerequisites for generating a Microsoft 365 license usage report via PowerShell

  • Permissions: Sign in as a Global Administrator, or with a role that can read license data, such as User Administrator. Consent to the User.Read.All and Organization.Read.All scopes when prompted. Microsoft lists LicenseAssignment.Read.All as the least privileged permission for reading subscriptions and per-user license details.
  • Tools: A PowerShell session with the Microsoft Graph PowerShell SDK installed.
  • Setup: Install the SDK if it is not already present:
    Install-Module Microsoft.Graph -Scope CurrentUser

Steps to generate a Microsoft 365 license usage report using PowerShell

  1. Connect to your tenant with the scopes needed to read subscriptions and users using Connect-MgGraph.
    Connect-MgGraph -Scopes "User.Read.All", "Organization.Read.All"
  2. List each subscription with its purchased, consumed, and available units, calculating available units as PrepaidUnits.Enabled minus ConsumedUnits because no cmdlet returns them directly.
    $skus = Get-MgSubscribedSku -All
    $skus | Select-Object SkuPartNumber, ConsumedUnits, @{ Name = "PurchasedUnits"; Expression = { $_.PrepaidUnits.Enabled } }, @{ Name = "AvailableUnits"; Expression = { $_.PrepaidUnits.Enabled - $_.ConsumedUnits } }
  3. Export every licensed user with their licenses using Get-MgUser, translating SKU IDs into part numbers with the subscription list from step 2.
    $skuLookup = @{}
    $skus | ForEach-Object { $skuLookup[$_.SkuId] = $_.SkuPartNumber }
    Get-MgUser -Filter 'assignedLicenses/$count ne 0' -ConsistencyLevel eventual -CountVariable licensedCount -All -Property DisplayName, UserPrincipalName, AccountEnabled, AssignedLicenses | Select-Object DisplayName, UserPrincipalName, AccountEnabled, @{ Name = "Licenses"; Expression = { ($_.AssignedLicenses.SkuId | ForEach-Object { $skuLookup[$_] }) -join "; " } } | Export-Csv -Path "C:\Reports\M365LicensedUsers.csv" -NoTypeInformation
  4. View the licenses and service plans assigned to one user with Get-MgUserLicenseDetail.
    Get-MgUserLicenseDetail -UserId "user@contoso.com"

List users assigned a specific license

Look up the subscription's SkuId, then filter users on it.

$sku = Get-MgSubscribedSku -All | Where-Object SkuPartNumber -eq "SPE_E5"
Get-MgUser -Filter "assignedLicenses/any(x:x/skuId eq $($sku.SkuId))" -ConsistencyLevel eventual -CountVariable skuUserCount -All

Check whether a license is assigned directly or through a group

AssignedByGroup is empty for direct assignments and holds the group's ID for licenses inherited from a group.

Get-MgUser -UserId "user@contoso.com" -Property LicenseAssignmentStates |
    Select-Object -ExpandProperty LicenseAssignmentStates |
    Select-Object SkuId, AssignedByGroup, State

Supported parameters: Connect-MgGraph

Parameter Description
-Scopes The Microsoft Graph permissions to request for the session.
-TenantId The tenant to connect to.
-ClientId The application (client) ID of the app registration used for app-only sign-in.
-CertificateThumbprint The thumbprint of the certificate used for app-only sign-in.

Supported parameters: Get-MgSubscribedSku

Parameter Description
-All Returns all subscriptions instead of a single page of results.
-Property Returns only the listed properties, such as SkuPartNumber and ServicePlans.

Supported parameters: Get-MgUser

Parameter Description
-Filter Returns users that match an OData filter, such as assignedLicenses/$count ne 0.
-ConsistencyLevel Set to eventual for advanced queries on properties such as assignedLicenses.
-CountVariable Stores the number of matching users in the named variable and is used with advanced queries.
-All Returns all matching users instead of a single page of results.
-Property Returns the listed properties, such as AssignedLicenses and AccountEnabled.
-UserId The object ID or user principal name of a single user.

Supported parameters: Get-MgUserLicenseDetail

Parameter Description
-UserId The object ID or user principal name of the user whose license details you want.
-Property Returns only specific properties of the license details, such as ServicePlans.

Limitations for generating a Microsoft 365 license usage report via PowerShell

  • There is no Graph PowerShell cmdlet that returns available licenses, so the script calculates them from purchased and consumed units.
  • Graph returns SKU part numbers such as SPE_E5 instead of the product names shown in the admin center, so readable names need a separate mapping.
  • Fetching license details user by user can hit Microsoft Graph throttling limits in large tenants.
  • Adding columns or changing the export format means editing the script and running it again.

How to generate a Microsoft 365 license usage report using ADManager Plus

Prerequisites

  • Permissions: A technician role that includes access to Microsoft 365 reports.
  • Setup: The Microsoft 365 integration is configured in ADManager Plus with valid tenant credentials, the Entra ID app registration has the required API permissions with admin consent granted, and the ADManager Plus server can connect to Microsoft Graph API.

Steps to generate a Microsoft 365 license usage report using ADManager Plus

  1. Log in to ADManager Plus and navigate to Microsoft 365 > Reports > License Reports.
  2. Under General License Reports, click License Details.
  3. Select the Microsoft 365 tenant from the drop-down list and click Generate Now. The report lists each subscription with its active, assigned, warning, suspended, and locked-out units. To see who holds the licenses, return to General License Reports and use the Licensed Users report.
    The License Details report in ADManager Plus showing units for each Microsoft 365 subscription.
    ADManager Plus License Details report
  4. Click Details under the License Details column to view the services assigned to a user.
    Service Details pop-up in the License Details report showing details for each Microsoft 365 subscription.
    Service Details pop-up in the License Details report
  5. Click Export As and choose CSV, PDF, XLSX, or HTML.

Steps to generate a Microsoft 365 licenses users report using ADManager Plus

  1. Log in to ADManager Plus and navigate to Microsoft 365 > Reports > License Reports.
  2. Under General License Reports, click Licensed Users.
  3. Select the Microsoft 365 tenant from the drop-down list and click Generate Now. The report lists each subscription with its active, assigned, warning, suspended, and locked-out units.
  4. To see who holds the licenses, return to General License Reports and click Licensed Users.
  5. Select the tenant from the Microsoft 365 Tenant drop-down list. In the Filter By pop-up, select the groups or domains to include and click Generate Now.
The Licensed Users report in ADManager Plus listing users with their assigned Microsoft 365 licenses.
ADManager Plus Licensed Users report

How ADManager Plus streamlines Microsoft 365 license usage reporting

  • Prebuilt license reports: Run the Licensed Users, Unlicensed Users, and License Details reports without writing or maintaining scripts.
  • Scheduled delivery: Schedule reports to run hourly, daily, weekly, or monthly and email them to the people who own license decisions.
  • License management: Assign, replace, or remove Microsoft 365 licenses in bulk after reviewing a report.
  • Delegation: Let help desk technicians run license reports without elevating their native privileges.
  • Automation: Automate recurring Microsoft 365 tasks, such as removing licenses from disabled accounts.

Real-world use cases

Use case 1: Count users per license by department

This script counts how many users hold each license in every department, limited to the licenses listed in $includeSkus.

Connect-MgGraph -Scopes "User.Read.All", "Organization.Read.All" -NoWelcome
# SkuPartNumbers to count. Leave empty to count every license.
$includeSkus = "SPE_E3", "SPE_E5"
$skuLookup = @{}
Get-MgSubscribedSku -All | ForEach-Object { $skuLookup[$_.SkuId] = $_.SkuPartNumber }
$userQuery = @{
    Filter = 'assignedLicenses/$count ne 0'
    ConsistencyLevel = "eventual"
    CountVariable = "licensedCount"
    All = $true
    Property = "DisplayName", "Department", "AssignedLicenses"
}
$licensedUsers = Get-MgUser @userQuery
$assignments = foreach ($user in $licensedUsers) {
    $department = if ($user.Department) { $user.Department } else { "(None)" }
    foreach ($license in $user.AssignedLicenses) {
        $sku = $skuLookup[$license.SkuId]
        if ($includeSkus -and $sku -notin $includeSkus) { continue }
        [pscustomobject]@{ Department = $department; License = $sku }
    }
}
$report = $assignments | Group-Object Department, License | ForEach-Object {
    [pscustomobject]@{
        Department = $_.Group[0].Department
        License = $_.Group[0].License
        Users = $_.Count
    }
} | Sort-Object Department, License
$report | Format-Table -AutoSize
$report | Export-Csv -Path "C:\Reports\LicenseCountByDepartment.csv" -NoTypeInformation

Use the Microsoft 365 user reports in ADManager Plus to count users per license by department:

  1. Log in to ADManager Plus and navigate to Microsoft 365 > Reports > User Reports > Microsoft 365 Users.
  2. Select the Microsoft 365 tenant and click Generate.
  3. Click Add/Remove Columns and include the department and license columns.
  4. Click the Filter icon, add a condition such as Department is Engineering, and click Apply Filter(s).
  5. Add a second condition on the license column for the license you want to count, apply it, and note the number of users returned.
  6. Repeat steps 4 and 5 for each department and license.
  7. Click Export As to save the filtered list as CSV, PDF, XLSX, or HTML.
  8. For org-wide counts, generate the License Details report under License Reports, which lists the assigned units for each license.
The Microsoft 365 Users report in ADManager Plus filtered by department, with the department and license columns shown.
Microsoft 365 Users report in ADManager Plus filtered by department and license

Use case 2: List last sign-in time alongside assigned licenses

This script lists every licensed user with the last sign-in time and the assigned licenses, and it needs the AuditLog.Read.All scope and a Microsoft Entra ID P1 or P2 license.

Connect-MgGraph -Scopes "User.Read.All", "AuditLog.Read.All", "Organization.Read.All" -NoWelcome
$skuLookup = @{}
Get-MgSubscribedSku -All | ForEach-Object { $skuLookup[$_.SkuId] = $_.SkuPartNumber }
$properties = "DisplayName", "UserPrincipalName", "AccountEnabled", "AssignedLicenses", "SignInActivity"
$users = Get-MgUser -All -Property $properties | Where-Object { $_.AssignedLicenses.Count -gt 0 }
$report = foreach ($user in $users) {
    $signIn = $user.SignInActivity.LastSignInDateTime
    $lastSeen = if ($signIn) { $signIn.ToString("yyyy-MM-dd") } else { "None recorded" }
    $licenses = ($user.AssignedLicenses.SkuId | ForEach-Object { $skuLookup[$_] }) -join "; "
    [pscustomobject]@{
        DisplayName = $user.DisplayName
        UserPrincipalName = $user.UserPrincipalName
        AccountEnabled = $user.AccountEnabled
        LastSignIn = $lastSeen
        Licenses = $licenses
    }
}
$report = $report | Sort-Object LastSignIn
$report | Format-Table UserPrincipalName, AccountEnabled, LastSignIn, Licenses -AutoSize
$report | Export-Csv -Path "C:\Reports\LastSignInWithLicenses.csv" -NoTypeInformation

ADManager Plus pairs the Inactive Users report with license management to show last logon and licenses together:

  1. Log in to ADManager Plus and navigate to Microsoft 365 > Reports > User Reports > Inactive Users.
  2. Select the Microsoft 365 tenant and choose the inactive period. If the tenant is directory sync enabled, you can exclude active AD users.
  3. Click Generate to list the users with their last logon and logoff times.
  4. Click Export As and choose CSV.
  5. Navigate to Microsoft 365 > Management > Assign/Remove Licenses.
  6. Select Import CSV, choose the file, and review the license details shown for each user.
  7. To remove the licenses of terminated employees, click Configure Licenses, select the users, choose Remove all licenses in the Assign/Remove Licenses list, choose the user location, and click Apply.
The Inactive Users report in ADManager Plus listing users with their last logon and logoff times.
Microsoft 365 Inactive Users report in ADManager Plus with last logon time
The Assign/Remove Licenses page in ADManager Plus listing imported inactive users with their license details.
Inactive users imported into Assign/Remove Licenses in ADManager Plus

FAQs

In the Microsoft 365 admin center, go to Billing > Licenses and open the Subscriptions tab to see the available and assigned licenses for each subscription. With PowerShell, run Get-MgSubscribedSku and subtract ConsumedUnits from PrepaidUnits.Enabled. ADManager Plus lists the same figures in its License Details report, along with warning, suspended, and locked-out units.

Run Get-MgUserLicenseDetail with the user's ID or user principal name to get the license details of a user. In ADManager Plus, open the Licensed Users report and click Details under the License Details column.

No. Microsoft retired the MSOnline PowerShell module between April and May 2025, so scripts that use Get-MsolUser stopped working. Get-MgUser with the AssignedLicenses property and a subscription lookup, as shown in the steps above, returns the same data.

Connect with the User.Read.All and Organization.Read.All scopes, as in the steps above. Microsoft lists LicenseAssignment.Read.All as the least privileged permission for reading subscriptions and per-user license details, and the -Scopes parameter of Connect-MgGraph accepts it. Listing users with Get-MgUser still needs User.Read.All.

The admin center exports usage report data as CSV, and Export-Csv does the same for the PowerShell scripts above. ADManager Plus exports its license reports as CSV, PDF, XLSX, or HTML, and its Microsoft 365 reports can also be scheduled and emailed.

Troubleshooting

The signed-in account or the consented scopes do not cover the data the command reads. Run Disconnect-MgGraph, reconnect with User.Read.All and Organization.Read.All (or User.ReadWrite.All for use case 2), grant admin consent if prompted, and confirm the account holds a role that can read license data.

A filter on assignedLicenses/$count is an advanced query. Add -ConsistencyLevel eventual and -CountVariable to the command, as in step 3 of the PowerShell steps.

Set-MgUserLicense cannot remove a license that comes from group-based licensing, which affects use case 2. Remove the user from the licensed group and run the script again. The Status column of the log lists the affected users.

Microsoft Graph throttles large numbers of per-user calls, such as Get-MgUserLicenseDetail inside a loop. Use Get-MgUser with the AssignedLicenses property and a subscription lookup, as in step 3 of the PowerShell steps, to avoid one request per user.

Send-MgUserMail needs the Mail.Send application permission with admin consent, and the address in -UserId must belong to a mailbox in your tenant. Run LicenseUsageReport.ps1 manually from a PowerShell session to see the error message.

ADManager Plus Trusted By

The one-stop solution to Active Directory Management and Reporting