Azure AD does not let you export users assigned a license. Group members can be exported, but not licences. Another reason to use Groups to assign licenses !
If you need all the members of a license type in a nice Excel spreadsheet, then :
First you need to get the SKU of the license type. In Graph Developer, run
and in the response search for the required license. In my case, I want the ID of the Dynamics full sales license. In the response one can see:
“servicePlans”: [ ..
so I can see the sku ID for Dynamics Enterprise is shown.
Using this SKU, I can run another Graph query:
https://graph.microsoft.com/beta/users?$filter=assignedLicenses/any(x:x/skuId eq ea126fc5-a19e-42e2-a731-da9d437bffcf)&$select=givenName,surname,userPrincipalName
which will give all users’ names and email for that Dynamics license.
If you do not have the relevant license, find a user in Azure with the license required, get their objectID, and run this Graph query:
and to retrieve ,for example ,Dynamics Team members search for DYN365_ENTERPRISE_TEAM_MEMBERS to get a sku ID of 8e7a3d30-d97d-43ab-837c-d7701cef83dc.
Copy the response from Graph and paste into a file (JSON format), and remove the odata line including the comma, and save.
Then open Excel, Data tab and select From JSON as below:
Open the file, click on the value : List row and click the Into table icon top left:
Then click on the icon next to Value and Expand to New Rows,.
Then click on the icon next to Value again and select your columns and OK:
After you’re happy with the data, click Close & Load in the top left, and the underlying Excel sheet will now have the data!