How to get list of users who have "Microsoft Teams Phone" license?

Jenuel Ganawed 20 Reputation points
2024-04-18T03:09:25.09+00:00

Hi! We are trying our customers users to check if their user have a "Microsoft Teams Phone" license.

Currently we get all users and loop through the users using the license details API to get the license each. The problem with this one is it takes time because we are looping each users and running the licensedetails API per user. Specially if the customer have many users in it.

Is their a better way to get list of user, and filter it? So that we only get the list of users that have "Microsoft Teams Phone" license?

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

Accepted answer
  1. Vasil Michev 95,581 Reputation points MVP
    2024-04-18T07:45:44.93+00:00

    Use filters. Here's an example:

    GET https://graph.microsoft.com/v1.0/users?$filter=assignedLicenses/any(c:c/SkuId eq e43b5b99-8dfb-405f-9987-dc307f34bcbd)&$select=id,userPrincipalName,assignedLicenses
    

    The above filter is based on the SKUid (e43b5b99-8dfb-405f-9987-dc307f34bcbd is the ID of Microsoft Teams Phone SKU), you can do the same for individual services within a plan:

    GET https://graph.microsoft.com/v1.0/users?$filter=assignedPlans/any(c:c/servicePlanId eq 4828c8ec-dc2e-4779-b502-87ac9ce28ab7)&$select=id,userPrincipalName,assignedPlans&$count=true
    

    (this is an advanced query, so needs the ConsistencyLevel=eventual header)

    You can get list of ids here: https://learn.microsoft.com/en-us/entra/identity/users/licensing-service-plan-reference


0 additional answers

Sort by: Most helpful