question

78929749 avatar image
0 Votes"
78929749 asked sreejukg answered

Microsoft Graph API - Get a list of all users with a specific license SKU

With Microsoft Graph API,

I want to get a list of users with a certain license such as O365 E3, Business Standard etc.

Get a user list
https://docs.microsoft.com/en-us/graph/api/user-list-licensedetails?view=graph-rest-1.0&tabs=http

Get a list of all allocated licenses of one user
https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0

What I want is, all the users' list hoding a certain license.

If it does not exist, I have to loop so many times which is low performance.

Please help. Thank you.
Daniel

microsoft-graph-profile
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

sreejukg avatar image
0 Votes"
sreejukg answered

You can use graph api to list the users and add filter parameter to get the users who are assigned with a particular license. This use case is documented in the following URL.

https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http#example-8-use-filter-to-get-users-who-are-assigned-a-specific-license

 GET https://graph.microsoft.com/v1.0/users?$select=id,mail,assignedLicenses&$filter=assignedLicenses/any(u:u/skuId eq cbdc14ab-d96c-4c30-b9f4-6ada7cdc1d46)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.