Update azure B2C custom attributes with Graph API C#.

Kripesh C K 1 Reputation point
2020-08-19T15:43:36.247+00:00

Hi,

Please help me on how can I update azure B2C custom attributes with Graph API C#.

Regards
Kripesh

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,449 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Saurabh Sharma 23,806 Reputation points Microsoft Employee
    2020-08-27T19:45:02.3+00:00

    @Kripesh C K
    Within the GitHub Repo linked, there is C# code used to get user and pull custom attributes. To view, you must know AppId of the app where extensions are created [More info on this concept here] and then also know the attribute name. https://github.com/Azure-Samples/ms-identity-dotnetcore-b2c-account-management/blob/master/src/Services/UserService.cs#L36-L68

    More code used to help with compiling custom attributes for the call to graph
    https://github.com/Azure-Samples/ms-identity-dotnetcore-b2c-account-management/blob/master/src/Helpers/B2cCustomAttributeHelper.cs#L7-L20

    Here is the code in that sample used to create a new user with custom attributes, the same concept can be applied when updating a user's custom attributes, they would need to send an update request to the user object. Here is code that was used for password updating, where the code can be modified to capture extension attribute updates
    https://github.com/Azure-Samples/ms-identity-dotnetcore-b2c-account-management/blob/master/src/Services/UserService.cs#L171-L189


  2. Heather Turner 1 Reputation point
    2020-11-06T18:45:47.983+00:00

    @Saurabh Sharma hello, is it possible to pull all the custom attributes for the user using microsoft graph api without getting them one by one via their name? The Extensions property doesnt seem to pull these values


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.