Forum Discussion

h4n1234's avatar
h4n1234
Frequent Visitor
4 years ago
Solved

Locating Object ID in Active Directory Connector

Could you tell me if a user Object ID is available through Power BI Active Directory Connector. 

 

 

I need the ID in order to identify users in the planner tasks I'm pulling in.

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi h4n1234 ,

     

    You could try the graph API:

    • /users/{user_id} targets an individual user in your tenant. You specify the user_id either as the object ID (GUID) or the user principal name (UPN) of the target user. You can use this resource path to get the declared properties of a user, to modify the declared properties of a user, or to delete a user. Note: For an external user, you must specify the user’s object ID (GUID).

     

    Request:

    GET https://graph.windows.net/myorganization/users?api-version[&$filter]

    Body:

    {
      "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryObjects/Microsoft.DirectoryServices.User",
      "value": [
        {
          "odata.type": "Microsoft.DirectoryServices.User",
          "objectType": "User",
          "objectId": "e61ff361-5baf-41f0-b2fd-380a6a5e406a",
          "deletionTimestamp": null,
    ......

     

    So you can add a blank query in Power BI Desktop, then paste the following code into Advanced Editor of the blank query.

    let
    
    Source = Json.Document(Web.Contents("https://graph.windows.net/myorganization/users?api-version=1.6")
    
    in
    
    Source

     

    For more information, please refer to the official document:

    Azure AD Graph API Operations on Users | Microsoft Docs

    Azure AD Graph API Reference | Microsoft Docs

     

    Or not in Power Query, but use DAX function——USEROBJECTID() that returns the current user's Object ID from Azure AD or security identifier (SID).

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi h4n1234 ,

     

    You could try the graph API:

    • /users/{user_id} targets an individual user in your tenant. You specify the user_id either as the object ID (GUID) or the user principal name (UPN) of the target user. You can use this resource path to get the declared properties of a user, to modify the declared properties of a user, or to delete a user. Note: For an external user, you must specify the user’s object ID (GUID).

     

    Request:

    GET https://graph.windows.net/myorganization/users?api-version[&$filter]

    Body:

    {
      "odata.metadata": "https://graph.windows.net/myorganization/$metadata#directoryObjects/Microsoft.DirectoryServices.User",
      "value": [
        {
          "odata.type": "Microsoft.DirectoryServices.User",
          "objectType": "User",
          "objectId": "e61ff361-5baf-41f0-b2fd-380a6a5e406a",
          "deletionTimestamp": null,
    ......

     

    So you can add a blank query in Power BI Desktop, then paste the following code into Advanced Editor of the blank query.

    let
    
    Source = Json.Document(Web.Contents("https://graph.windows.net/myorganization/users?api-version=1.6")
    
    in
    
    Source

     

    For more information, please refer to the official document:

    Azure AD Graph API Operations on Users | Microsoft Docs

    Azure AD Graph API Reference | Microsoft Docs

     

    Or not in Power Query, but use DAX function——USEROBJECTID() that returns the current user's Object ID from Azure AD or security identifier (SID).

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.