Rest API to query to resolve AD Object ID to display name.

Aidan Dowling 0 Reputation points
2023-06-27T13:26:06.6233333+00:00

In the Active Directory GUI within Azure I can search an ID and this will return the user in the organization with that id (including managed identities, service principles and app registrations) - does anyone know the endpoint to retrieve this using a Rest API?

Are their any permissions associated with this I will need to seek?

Thanks in advance!

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

3 answers

Sort by: Most helpful
  1. Michael Smith 2,931 Reputation points Microsoft Employee
    2023-06-27T13:46:50.1733333+00:00

    Hi Aidan,

    you can use the graph REST API to retrieve that data.

    https://graph.microsoft.com/v1.0/users

    Permissions needed would be Directory.Read.All

    A good place to test the out the REST APIs is the graph explorer.

    https://developer.microsoft.com/en-us/graph/graph-explorer

    Let me know if this what you were looking for or if theres anything further i can help with.


  2. CarlZhao-MSFT 46,371 Reputation points
    2023-06-28T03:26:09.13+00:00

    Hi @Aidan Dowling

    This is a global search box that can search users/groups/applications within a tenant by a given value. As far as I know, there is currently no Graph API endpoint available for global search, you must call the corresponding API endpoint based on the given value.

    Each API endpoint has its corresponding API permissions. Based on the principle of least privilege, we recommend that you grant the lowest privilege to the call principal to perform fine-grained access.

    User's image

    2

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

  3. Alfredo Revilla - Upwork Top Talent | IAM SWE SWA 27,526 Reputation points Moderator
    2023-06-28T05:47:45.5633333+00:00

    Hello @Aidan Dowling , extending answers provided by my colleagues, there's actually an endpoint that will allow you to get any Azure AD object that inherits from directory object (application, servicePrincipal, user, administrativeUnit, appRoleAssignment, directoryRole, device, group, and orgContact) using its object id. Please take a look to Get directoryObject. Both user and application permissions are supported.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.


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.