Report · 2 tools
Licence assignment report by SKU
Summary
Shows how many licences you own, how many are assigned, and which users hold each SKU, with friendly names for the SKU part numbers. Run it before buying more licences or planning a migration.
Implementation
Choose your tool. Your choice is remembered on other samples.
Connect-MgGraph -Scopes Organization.Read.All, User.Read.All -NoWelcome
$skus = Get-MgSubscribedSku -All
$skus | Select-Object SkuPartNumber,
@{ n = "Purchased"; e = { $_.PrepaidUnits.Enabled } },
@{ n = "Assigned"; e = { $_.ConsumedUnits } },
@{ n = "Free"; e = { $_.PrepaidUnits.Enabled - $_.ConsumedUnits } } | Format-Table
$skuName = @{}; $skus | ForEach-Object { $skuName[$_.SkuId] = $_.SkuPartNumber }
Get-MgUser -All -Property UserPrincipalName, AssignedLicenses |
ForEach-Object { $u = $_; $u.AssignedLicenses | ForEach-Object {
[pscustomobject]@{ User = $u.UserPrincipalName; Sku = $skuName[$_.SkuId] } } } |
Export-Csv .\licence-assignments.csv -NoTypeInformationm365 login
m365 entra license list --output csv > subscribed-skus.csv
m365 entra user list --properties "userPrincipalName,assignedLicenses" --output json > users-licences.jsonPrerequisites
- Graph scopes Organization.Read.All and User.Read.All
Output
Summary table per SKU, and a CSV of user and SKU pairs.
Contributors
| Author | Role |
|---|---|
| Priyanshu Upadhyay | Solution Architect, Microsoft 365 and Azure |
InnovaticT