Unable to retrieve custom attribute via graph API

sam nick 281 Reputation points
2023-08-25T16:23:46.0266667+00:00

Hello,

I am trying to retrieve the custom attributes for a user via graph, but cant seem to find them in the result set. Please can you advise what am i missing and how to get those values. Do i need a different query or "join" to another parameter to get the value. I am a global admin and have the attribute assignment admin.

User's image

User's image

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
2,174 questions
Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
16,641 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manu Philip 16,571 Reputation points MVP
    2023-08-25T17:13:05.9733333+00:00

    You can try the following query to show the custom attributes for the user

    https://graph.microsoft.com/v1.0/users/manu@exchangeonline.in?$select=onPremisesExtensionAttributes

    $select=displayName,onPremisesExtensionAttributes will show only the display name along with all the custom attributes


    --please don't forget to upvote and Accept as answer if the reply is helpful--


  2. Vasil Michev 79,546 Reputation points MVP
    2023-08-25T17:28:07.2466667+00:00

    You have to specifically request the custom attributes themselves, or the set as a whole. For example, this query will include all custom security attributes:

    https://graph.microsoft.com/beta/users?$select=id,displayName,customSecurityAttributes

    Do make sure that the CustomSecAttributeDefinition.Read.All scope has been consented to, and if you are running this via the Graph explorer tool (or any other method that leverages delegate permissions), that the corresponding user has sufficient permissions to access the CSA set(s) in question.

    Additional details and more examples can be found in the official documentation: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/users-custom-security-attributes?tabs=ms-powershell