Microsoft GRAPH API to manage Microsoft Teams Licenses

Marco Churra 0 Reputation points
2023-05-17T07:04:19.1733333+00:00

Good morning,

I would like to know if the following scenario is possible:

If I have 5 Microsoft Teams Professional Basic Licenses and I have 10 users, is it possible to use Microsoft Graph API to automatically assign these 5 licenses to 5 users, when they login, and then when one of them logouts, unassign the license automatically from that user?

Thank you

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,391 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,846 Reputation points
    2023-05-18T02:25:10.3+00:00

    Hi Marco Churra ,currently, the Graph API supports the ability to grant and remove licenses for login account through this endpoint Includes delegated permission and application permission.

    Here is the documentation for your reference. Hope this helps. Best Wishes.

    POST https://graph.microsoft.com/v1.0/me/assignLicense
    Content-type: application/json
    
    {
      "addLicenses": [
        {
          "disabledPlans": [ "11b0131d-43c8-4bbb-b2c8-e80f9a50834a" ],
          "skuId": "45715bb8-13f9-4bf6-927f-ef96c102d394"
        }
      ],
      "removeLicenses": [ "bea13e0c-3828-4daa-a392-28af7ff61a0f" ]
    }
    

    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.

    0 comments No comments