Playing with GraphAPI is fun, as it gives a straightforward way to read data and integrate user information with any application. In this post, I will explain the licenseDetails endpoint and how to use it.

Prerequisites

Using Microsoft Graph Explorer is the easiest way to test these endpoints.

  • You need a user ID or UserPrincipalName to query.
  • The requester must have an API permission Directory.Read.All.
  • This post assumes you understand the MSGraph basics, if you like a memory refresher, then take a look at Connecting and Understanding Microsoft Graph API Using PowerShell as it covers all the details you need to understand about Microsoft GraphAPI.
  • Internet Connection, for sure.

Working with licenseDetails Endpoint

I use Microsoft Graph Explorer as it is easy to see the result, so when calling https://graph.microsoft.com/v1.0/users/{User-ID}/licenseDetails with a GET method, the following data return as a result of the call

This is not a Beta endpoint so use v1.0

After calling the endpoint, it returns the list of licenses and enabled services assigned to the user. Each license contains multiple properties.

So take a look at the data inside the “value” JSON array

 "value": [
        {
            "id": "7uqfl8u5XUuzw1oR7pW4CZK4DfPpB-lHg3yAcn9G_T0",
            "skuId": "f30db892-07e9-47e9-837c-80727f46fd3d",
            "skuPartNumber": "FLOW_FREE",
            "servicePlans": [
                {
                    "servicePlanId": "113feb6c-3fe4-4440-bddc-54d774bf0318",
                    "servicePlanName": "EXCHANGE_S_FOUNDATION",
                    "provisioningStatus": "Success",
                    "appliesTo": "Company"
                },
                {
                    "servicePlanId": "50e68c76-46c6-4674-81f9-75456511b170",
                    "servicePlanName": "FLOW_P2_VIRAL",
                    "provisioningStatus": "Disabled",
                    "appliesTo": "User"
                }
               ]
             ]

The SKU means Stock Keeping Unit, is a license template from which individual licenses may be issued 

When calling this endpoint the following properties return 

ID: a unique ID for the license feature, this ID is related to the license itself only not the userID.

skuPartNumber: The name of the License, this can be SPB, WIN_ENT_E5, AAD_PREMIUM… and more. You can read the skuPartNumber translation from Product names and service plan identifiers for licensing

This is the same item you find when opening Microsoft 365 Admin Center –> Users –> Active User –> Select a user –> Licenses and apps

skuId: Related to the registered license

servicePlans: Each license has a sub-component for example a License name SPB “Microsoft 365 Business Premium” includes items like PURVIEW_DISCOVERY,MICROSOFT_LOOP… as you can enable a single feature or serviceplan for the user, maybe you dont want the user to have email service but you want the user to have a voice service. you can find these from the same location as the Licenses and Apps, but at the bottom of the screen you see Apps

So the servicePlans is the list of enabled plans for the user and it includes the following items 

servicePlanId: and ID for the serviceplan.  

servicePlanName: The name of the service plan, such as PURVIEW_DISCOVERY…etc 

provisioningStatus : Is the status of the service if it is enabled or not, for some reason the feature cannot be enabled due to a limitation of license count or whatever so simply the administrator decide not to provide this feature for the user. The possible value can be

  • Success – Service is fully provisioned.
  • Disabled – Service is disabled.
  • Error – The service plan isn’t provisioned and is in an error state.
  • PendingInput – The service isn’t provisioned and is awaiting service confirmation.
  • PendingActivation – The service is provisioned but requires explicit activation by an administrator (for example, Intune_O365 service plan)
  • PendingProvisioning – Microsoft has added a new service to the product SKU and it isn’t activated in the tenant.

appliesTo: is the scope, as some features only enabled for a user and the other enabled on the Organizational level 

That it, I just wanted to make a quick explanation about this endpoint, but you can get more information about the assigned license to the organization by https://graph.microsoft.com/v1.0/subscribedSkus with a GET method. This endpoint provides an organizational level view of the license consumption and an overview of the status.

5/5 - (1 vote)