I have created an Azure B2C custom attribute called IsAdmin on the portal, added it to a Sign In / Sign Up user flow, and then using the Graph API, successfully created a new user with IsAdmin = true. If I then sign in using that new user I can see IsAdmin returned in the token as a claim. So far so good.
However I can’t seem to see that custom attribute when querying via Graph API, nor can I search for it.
var user = await graphClient.Users["{GUID HERE}"]
.Request()
.GetResponseAsync();
The user is returned, but the custom attribute is not present.
var results = await graphClient.Users
.Request()
.Filter("extension_anotherguid_IsAdmin eq true")
.GetAsync();
Returns no results.
Does anyone have any idea?
2
Answers
Extensions are not returned by default. You need specify the extension in Select
The value should be available through
AdditionalData
.Resources:
Extensibility
When storing custom attribute in a B2C tenant, a microsoft’s managed app registration is created :
Take the app id of this app registration, remove the dashes in the id and then use it like below :