How Can I List ALL Custom Attributes of a User In Azure B2C using Graph API

devopsfj 256 Reputation points
2023-07-18T15:08:18.6566667+00:00

I want to list all custom attributes of a user at once, is this possible?

I know I can run check each individual custom attribute like this

https://graph.microsoft.com/v1.0/users/<user id>?$select=extension_<extension app id>_MyCustomAttribute

But I am looking to list ALL custom attributes for a user, is this possible?

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

Accepted answer
  1. CarlZhao-MSFT 46,376 Reputation points
    2023-07-19T08:57:08.3933333+00:00

    Hi @Hi @devopsfj

    The easiest way is to use the /beta endpoint to list all attributes of the target user, both basic and custom. Otherwise, you can only use the SDK to filter its result set, which I do not recommend.

    https://graph.microsoft.com/beta/users/{user id}
    

    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.

    4 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. TH-4749-MSFT 3,315 Reputation points
    2023-07-18T16:36:13.42+00:00

    Hi devopsfj,

    Thanks for reaching out. You can list the custom attributes (extensions) for a user using the below query:

    https://graph.microsoft.com/v1.0/users/[UserID]?$expand=extensions&$select=id,displayName,extensions

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

    Thanks.


  2. CarlZhao-MSFT 46,376 Reputation points
    2023-07-19T06:15:02.3766667+00:00

    Hi @devopsfj

    Yes, you can list all custom attributes of a user at once.

    Try this:

    https://graph.microsoft.com/v1.0/users/{user id}?$select=extension_<extension app id>_MyCustomAttribute1,extension_<extension app id>_MyCustomAttribute2......
    

    6

    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.


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.