MS Graph - Assign license to user

Ayan Usmani 171 Reputation points

I am assigning Microsoft 365 E3 whose SKU is "05e9a617-0261-4cee-bb44-138d3ef5d965 " using assignLicense API.

This works fine sometime but sometime I am getting this error :

'message': 'Subscription with SKU 05e9a617-0261-4cee-bb44-138d3ef5d965 does not have any available licenses.

Let me know, why this is happening & what needs to be taken care while using this API.

Here is the API :

POST -{userPricipalName}/assignLicense

body :

"addLicenses": [
"skuId": "05e9a617-0261-4cee-bb44-138d3ef5d965"
"removeLicenses": [ ]

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,776 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,777 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,831 Reputation points

    Hi @Ayan Usmani ,
    Per my test, before using the API, you must have the relevant license in your tenant that you can see in AD.


    Then you can use the List subscribedSkus API: GET /subscribedSkus to list the license that you have subscribed to. You can check if the Sku: 05e9a617-0261-4cee-bb44-138d3ef5d965 is being subscribed. And the skuId property can be used to assign license.


    I tested it locally and then made it run successfully by adding the disabledPlans property, the value of which is the servicePlanId in the response of the /subscribedSkus endpoint.

    Hope this helps. Wish you all the best.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Ayan Usmani 171 Reputation points

    Thanks @Zehui Yao_MSFT .... i have done the same.

    I had fetched the details of license and I can see that we have license with skuID - 05e9a617-0261-4cee-bb44-138d3ef5d965 .

    But when I am trying to add the same license for another user it throws me the below error :

    Do let me know what's going wrong over here.

    1 person found this answer helpful.