License & Subscription Issues

Can Microsoft License Quantities Be Increased via Graph API or CLI?

Algirdas JasaitisAlgirdas Jasaitis Oct 13, 2026 870 views

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.

Can Microsoft License Quantities Be Increased Through Graph API or CLI?
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.
Before you start

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.

Solution 1Recommended

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.

1
Log in to the Microsoft 365 Admin Center

Navigate to the Microsoft 365 admin portal and sign in with your Billing or Global Administrator credentials.

2
Increase your license quantity

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.

3
Verify available licenses via Graph API

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.

4
Retry your automated assignment script

Once the new licenses are verified, rerun your user provisioning automation to assign the licenses using the standard 'assignLicense' Graph API endpoint.

Purchase Additional Licenses via Admin Center and Assign via Graph API
Update Error Handling in Scripts: Ensure that your automated CLI or Graph API scripts are configured to gracefully handle insufficient-license errors. They should notify IT or billing administrators when a manual purchase is required rather than simply failing silently.
Free Microsoft Office alternative

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. 1. Visit the WPS Website: Go to the official WPS Office website to access the download page.
  2. 2. Download the Installer: Click 'Download WPS Office Free' to get the lightweight installation package for your operating system.
  3. 3. Install and Open Files: Run the installer, open the application, and seamlessly load your existing Microsoft Office documents without format loss.
No complicated per-user API license provisioning or billing management required.Fully compatible with Microsoft Word, Excel, and PowerPoint file formats (.docx, .xlsx, .pptx).Lightweight installation with a familiar, intuitive user interface for seamless team migration.Includes comprehensive built-in PDF editing tools for everyday business needs.
microsoft office alternative - wps office

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.