1

I am "successfully" querying an Azure AD B2C user via GraphServiceClient provided by Microsoft.Graph using:

var b2cUser = await graphServiceClient.Users[id].Request().GetAsync();

The returned user object does not appear to be populated correctly. Nearly all of the properties, including Id, are set to null. The data I would expect to see within the structure however is contained within in a raw key-value dictionary property called AdditionalData.

I was expecting the GraphServiceClient to do the work of parsing the JSON returned by the Microsoft Graph API. Is what I am seeing the correct behaviour or should I be using the library differently? I would be happy to be referred to the documentation for GraphServiceClient but my googling foo has failed me so far...

If I try to use select like this:

var b2cUser = await graphServiceClient.Users[id].Request().Select("id").GetAsync();

I get a System.AggregateException exception for every field I have tried.

Mat
  • 539
  • 6
  • 20
  • see [Which Graph API should be used with Azure AD B2C](https://stackoverflow.com/questions/43770376/which-graph-api-should-be-used-with-azure-ad-b2c) – spottedmahn Apr 30 '18 at 16:34
  • How did you get it to authenticate? I can only authenticate against Azure AD Graph. – James South Nov 15 '18 at 22:33
  • @JamesSouth If you are asking how I authenticated against Microsoft.Graph, I think I used https://github.com/microsoftgraph/aspnetcore-connect-sample as an example. But it has been a while since I did it. I don't want to send you off on a wild goose chase... To authenticate against Azure AD Graph API, https://github.com/AzureADQuickStarts/B2C-GraphAPI-DotNet contains working code. – Mat Nov 16 '18 at 14:22

1 Answers1

3

You are using the .NET client library for Microsoft Graph.

Currently, you must use Azure AD Graph API to manage users in an Azure AD B2C tenant, since Microsoft Graph doesn't support a few of the user properties (including the creationType property) that are used by Azure AD B2C.

This Microsoft Graph or the Azure AD Graph article indicates that the current gap between the Microsoft Graph and Azure AD Graph APIs for managing users in an Azure AD B2C tenant.

Chris Padgett
  • 14,186
  • 1
  • 15
  • 28