Download Users + Assigned licenses API

TheNewGuy-0614 60 Reputation points
2025-02-09T23:34:50.12+00:00

Hello Dear Community,

I have noticed that in the Microsoft_AAD_UsersAndTenants / User Management Menu, the list of users can be displayed with different columns/properties:

User's image

I would like to ask:

  1. how can that be exported with the displayed columns , instead of hardcoded columns?
    The "download users" button seems to have a fix columns settings, but I do not want all those, just a few and the additional selected ones I pick: https://learn.microsoft.com/en-us/entra/identity/users/users-bulk-download
  2. for the "Assigned licenses" column, the returned values are "Yes" or "No".
    I am curious, which is the API call behind that column?
    Until now I was using the MS Graph's Get-MgUserLicenseDetail , but I would like to use something simpler and faster, if the UI already has this output..

Thank you for the help!!

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 119.9K Reputation points MVP Volunteer Moderator
    2025-02-10T17:03:28.8033333+00:00

    You can just hit F12 on that page to open the browser's dev tools and monitor the calls being made under the Network tab. Microsoft has been working hard to make sure almost everything in the Entra ID portal is backed by running the corresponding Graph API requests, so if you ever want to see what the exact method/call is, F12 is the easiest way.

    As for the export, I'm afraid it's hard-coded. You can however easily mimic the behavior via the Graph SDK for PowerShell and the Get-MgUser cmdlet. If you need a quick check whether the user is licensed, you simply need to check the whether the assignedLicenses property has a non-null value. Here's a quick example:

    Get-MgUser -All -Property Id,DisplayName,JobTitle,assignedLicenses | select Id,DisplayName,JobTitle,@{n="IsLicensed";e={if ($_.assignedLicenses) {$true} else {$false}}}
    

    Make sure to add any remaining properties as you see fit. The downside of having to do this via the module is the crappy syntax it uses, as you have to add each property you want displayed twice (once for the -Property parameter and once for the select statement).


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.