Optimize inactive Microsoft 365 premium licenses with Graph and Teams
Needs changesWhat this workflow does
This workflow has 26 nodes and runs on a schedule (cron 0 6 1 * *). Along the way it connects Microsoft Teams. It also calls graph.microsoft.com over HTTP.
How it runs
Trigger: On a schedule (cron 0 6 1 * *).
- Set Configuration Parameters (Edit Fields (Set)): sets 10 fields: premiumSkuPartNumbers, baselineSkuId, inactivityThresholdDays…
- Validate Configuration (Code): runs custom JavaScript code
- Fetch Subscribed SKUs (HTTP Request): calls graph.microsoft.com
- Generate Premium SKU Map (Code): runs custom JavaScript code
- Retrieve Exemption Group Members (HTTP Request): calls an HTTP API
- Compile Exemption List (Item Lists): reshapes item lists (legacy Item Lists node)
- Fetch All Licensed Users (Code): runs custom JavaScript code
- Filter Inactive Premium Members (Code): runs custom JavaScript code
- Check Downgradable Users (If): checks a condition and branches into true / false
- Divide Downgrade Plan (Code): runs custom JavaScript code
…plus 12 more steps. See the full node list below.
Services it uses
HTTP calls to: graph.microsoft.com
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- Item Lists (legacy) in Compile Exemption List, Gather Downgrade Results: replace with Split Out, Aggregate, Sort, Limit, Remove Duplicates or Summarize (match the operation used).
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
Published 2026 — 6% of 2026 templates need changes for 3.0. See how template age affects 3.0 readiness →
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
| Removed in 3.0 | Replace with |
|---|---|
| Item Lists (legacy) Compile Exemption List, Gather Downgrade Results | Split Out, Aggregate, Sort, Limit, Remove Duplicates or Summarize (match the operation used) |
Nodes used (10)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - HTTP Request
n8n-nodes-base.httpRequest - Item Lists
n8n-nodes-base.itemLists - If
n8n-nodes-base.if - Microsoft Teams
n8n-nodes-base.microsoftTeams - No Operation, do nothing
n8n-nodes-base.noOp - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Wait
n8n-nodes-base.wait
From the author
Quick overview This workflow runs monthly to audit Microsoft 365 licensing via Microsoft Graph, identifies inactive users holding premium SKUs (excluding an exemption group and recent hires), optionally downgrades them to a baseline license, and posts a…