Can Microsoft License Quantities Be Increased via Graph API or CLI?
Question details
The user wants to know if it is possible to programmatically purchase or increase the number of Microsoft 365 licenses using Microsoft Graph API or CLI tools when the current pool is exhausted.

- Product
- Microsoft Graph API
- Device & OS
- not provided
- Scenario
- Automating Microsoft 365 user onboarding and license assignment using scripts, which fail when no available licenses remain in the tenant.
- Observed behavior
- The Microsoft Graph API license assignment fails because all available purchased licenses are currently assigned, requiring a seat increase.
Ensure you have Global Administrator or Billing Administrator permissions in your Microsoft 365 tenant, and access to the Microsoft 365 Admin Center to authorize new purchases.
Purchase Additional Licenses via Admin Center and Assign via Graph API
Microsoft Graph API and standard CLI tools cannot purchase or increase subscription limits. You must increase the seat count manually via the billing portal before your automation can assign them.
Microsoft Graph and command-line tools are designed to assign licenses that are already available in your tenant inventory. They do not increase the purchased quantity of a subscription.
When no licenses remain, you must purchase additional seats through the Microsoft 365 admin center, your licensing portal, or a supported commerce API tied to your enterprise billing account. Once provisioned, your API scripts can resume assigning those newly available seats.
Navigate to the Microsoft 365 admin portal and sign in with your Billing or Global Administrator credentials.
Go to 'Billing' > 'Your products' in the left-hand menu. Select the subscription that has run out of licenses, and click 'Buy licenses' or 'Increase quantity' to complete the checkout process.
Send a GET request to 'https://graph.microsoft.com/v1.0/subscribedSkus' to query your subscription details. Check that the 'prepaidUnits' and 'consumedUnits' values reflect the newly purchased availability.
Once the new licenses are verified, rerun your user provisioning automation to assign the licenses using the standard 'assignLicense' Graph API endpoint.

Need a Cost-Effective Alternative to Microsoft 365? Try WPS Office
If managing Microsoft 365 license limits, API provisioning errors, and subscription costs is becoming a burden for your organization, consider switching to WPS Office. It provides a lightweight, highly compatible alternative to standard Microsoft Office applications without the complex license management overhead.
- 1. Visit the WPS Website: Go to the official WPS Office website to access the download page.
- 2. Download the Installer: Click 'Download WPS Office Free' to get the lightweight installation package for your operating system.
- 3. Install and Open Files: Run the installer, open the application, and seamlessly load your existing Microsoft Office documents without format loss.

Frequently Asked Questions
Why does Microsoft Graph API return a 'License cannot be assigned' error?
This error most commonly occurs when your tenant has exhausted its pool of available licenses for a specific SKU. It can also happen if the target user's 'usageLocation' property has not been set prior to license assignment.
Can I automate Microsoft 365 license purchasing using APIs?
Standard Microsoft Graph API does not support commercial transactions like buying licenses. You would need to use specific Partner Center APIs (if you are a CSP) or Commerce APIs depending on your organization's enterprise agreement.
How long does it take for newly purchased licenses to appear in Graph API?
Once additional seats are purchased in the Microsoft 365 Admin Center, it typically takes a few minutes for the new quantities to reflect when querying the subscribedSkus endpoint. Occasionally, system replication can take up to 24 hours.
How do I check my available license count using Graph API?
You can query your current license availability by making a GET request to the 'https://graph.microsoft.com/v1.0/subscribedSkus' endpoint. Subtract the 'consumedUnits' from the total 'prepaidUnits' to find the number of licenses available for assignment.




