Identify licenses assigned to inactive accounts, surface unassigned SKUs, and produce a prioritized optimization plan with estimated monthly savings.
Complexity: Intermediate. Impact: cost-savings + license-optimization + reporting + quarterly-audit + finops.
Why use this workflow
License sprawl accumulates easily: departed employees whose accounts were never disabled, contractors who only needed access for a quarter, or bulk purchases that left unassigned SKUs idle. Without a regular audit, you can end up paying for seats that no one uses.
This workflow walks through a repeatable audit that cross-references subscribed SKUs (what you own) against user sign-in activity (who uses it) to surface three categories of waste:
- Inactive licensed users: accounts with expensive licenses (E3, E5, Visio, Project) that have not signed in for 90 or more days.
- Unassigned SKUs: purchased seats sitting idle in the tenant.
- Downgrade candidates: users on E5 who only use E3-tier features (no Defender, no Power BI Pro, no phone system).
Run this quarterly, before renewal negotiations, or whenever Finance asks about the Microsoft bill.
Expected outcomes
After completing this workflow you will have:
- A complete inventory of subscribed SKUs with total, assigned, and available counts.
- A list of inactive users (90 or more days with no sign-in) who currently hold paid licenses.
- A count of unassigned licenses per SKU.
- An optimization plan identifying which licenses to reclaim, downgrade, or let lapse.
- An estimated monthly and annual savings figure to bring to Finance or your Microsoft account representative.
Risks and considerations
Before you reclaim licenses
- Do not remove licenses from shared mailboxes or resource accounts. These legitimately have no sign-in activity but may still need an Exchange license (for example, over 50 GB or with litigation hold applied).
- Check for service account exemptions. Break-glass accounts, automation identities, and hybrid sync accounts may show as inactive but must keep their licensing.
- Removing an E5 or E3 license starts mailbox deletion after 30 days. If the user is on leave, convert the mailbox to shared before unlicensing, or place it on retention hold first.
- Guest (B2B) users are licensed differently from member users. Do not count them as waste.
signInActivityrequires Microsoft Entra ID P1 or higher. If you see null values everywhere, your tenant may lack the SKU that populates this field.- Coordinate with HR before disabling accounts flagged as inactive. An inactive user may be on parental leave.
Required permissions
| Permission | Why it's needed |
|---|---|
| Organization.Read.All | List subscribed SKUs, their assigned and consumed unit counts, and service plans. |
| User.Read.All | Enumerate users and their assignedLicenses property to cross-reference with activity. |
| AuditLog.Read.All | Access the signInActivity property on the user object to determine last sign-in date. |
| Reports.Read.All | Pull per-service usage reports (Teams, OneDrive, Exchange, SharePoint) to spot users with a license but no product usage. |
Ask Dex
Paste the prompt into a Dex conversation.
Prompt for IT admins
Audit our Microsoft 365 licensing. Find users inactive for {days} days who still hold paid licenses, list unassigned SKUs, and produce an optimization plan with estimated monthly and annual savings. Flag E5 users with no Teams/OneDrive activity as downgrade candidates. Do not remove anything - just produce the report.
Manual steps (admin center)
Use this path for a one-off audit or a spot-check. For larger tenants, use the Graph API or PowerShell approaches instead.
Step 1: Review overall license position
- Sign in to the Microsoft 365 admin center as a Global Reader or Global Administrator.
- Go to Billing > Licenses.
- For each subscription, note Assigned vs Total. The difference is your unassigned SKU count.
- Click any SKU to see the per-user assignment list.
Step 2: Identify inactive users
- Open the Microsoft Entra admin center and go to Identity > Users > All users.
- Click Add filter and choose Last sign-in date (interactive).
- Set the filter to Before a date 90 days ago.
- Add a second filter for Account enabled = Yes.
- Export the filtered list to CSV using Download users.
Step 3: Cross-reference licenses
- Open the exported CSV in Excel and add a column for assigned license SKUs.
- Filter for rows where the license column is not empty. These are your reclaim candidates.
- Sort by SKU to prioritize the most expensive licenses (E5, then E3, then Business Premium, then Business Standard).
Step 4: Spot unused premium features
- In the Microsoft 365 admin center, go to Reports > Usage.
- Review the Microsoft 365 Apps usage, Teams user activity, and OneDrive usage reports for the last 90 days.
- Users with an E5 license but no Teams or OneDrive activity are downgrade candidates.
Step 5: Act on findings
- For confirmed inactive accounts, remove the license: Users > Active users > select the user > Licenses and apps.
- For unassigned SKUs, contact Microsoft billing support or your CSP or reseller to reduce the seat count at renewal.
- For downgrades, assign the cheaper SKU first, then remove the more expensive one, to avoid service interruption.
Microsoft Graph API
The audit uses three Graph endpoints. Run them in order and join the results client-side.
1. List all subscribed SKUs
GET https://graph.microsoft.com/v1.0/subscribedSkusReturns an array of SKU objects. The fields you need:
skuId: GUID used inuser.assignedLicenses.skuPartNumber: human-readable name (for example,ENTERPRISEPREMIUM).prepaidUnits.enabled: total seats purchased.consumedUnits: seats currently assigned.prepaidUnits.enabled - consumedUnits: unassigned seats.
2. Enumerate users with licenses and sign-in activity
GET https://graph.microsoft.com/v1.0/users?$select=id,userPrincipalName,displayName,accountEnabled,assignedLicenses,signInActivity&$top=999Pagination: follow @odata.nextLink until it is absent. Do not rely on a single page for tenants over 999 users.
Example response fragment:
{
"userPrincipalName": "jane@contoso.com",
"accountEnabled": true,
"assignedLicenses": [{ "skuId": "c7df2760-..." }],
"signInActivity": {
"lastSignInDateTime": "2024-03-14T09:22:11Z"
}
}3. (Optional) Pull per-service usage reports
For deeper downgrade analysis, pull 90-day activity reports. These endpoints return CSV by default:
GET /v1.0/reports/getOffice365ActiveUserDetail(period='D90')
GET /v1.0/reports/getTeamsUserActivityUserDetail(period='D90')
GET /v1.0/reports/getOneDriveUsageAccountDetail(period='D90')A user with an E5 license, an empty Teams Last Activity Date, and zero OneDrive file count is a downgrade candidate.
Join logic
- Build a dictionary of
skuIdto partNumber, unassigned count, and estimated cost from call 1. - For each user from call 2, flag as inactive if
accountEnabled = trueAND (signInActivity.lastSignInDateTimeis null or older than 90 days) ANDassignedLicenses.length > 0. - Aggregate potential savings: (inactive users per SKU + unassigned units per SKU) multiplied by the SKU monthly price.
Note: Graph does not return license prices. Maintain a lookup table of your negotiated rates from your Enterprise Agreement or CSP invoice.
PowerShell
High-level flow:
- Connect to Graph with the four required scopes.
- Fetch all
subscribedSkusand build a price lookup (you provide rates in a hashtable). - Page through all users with
Get-MgUser, selectingsignInActivityandassignedLicenses. - Classify each licensed user as active, inactive (90 or more days), or never signed in.
- Export three CSV reports: inactive licensed users, SKU utilization, and an optimization plan.
- Print a summary with estimated monthly and annual savings.
Prerequisites
Install-Module Microsoft.Graph -Scope CurrentUser- Microsoft Entra ID P1 or higher (required for
signInActivitydata). - At minimum the Global Reader role. Add License Administrator if you also plan to act on findings.
This workflow produces a plan for you to review. It does not remove licenses.