User info via MS Graph API is not full

Maria Senkiv 46 Reputation points
2021-09-22T12:02:01.877+00:00

Hello team,
We are trying to migrate authorization process of our project to B2C tenant. I've set up 'Self sign-in / sign-up' user flow with Local account (Email) Identity provider. During sign-up process user enters his email and sign ups successfully. In Azure POrtal I see that user mail is displayed as User Principal but the response from MS Graph API has the following format:
{
"@odata.id": "https://graph.microsoft.com/v2/0182be13-23bf-45ec-a6de-054f50a9a0c0/directoryObjects/45c92a76-9e09-4e5d-8e45-472d38d166e8/Microsoft.DirectoryServices.User",
"businessPhones": [],
"displayName": "Display name",
"givenName": "Name",
"jobTitle": "Job",
"mail": null,
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "******@mycompany.onmicrosoft.com",
"id": "6a82de4d-2f48-45cf-9e8d-753393fac0d0"
}

So neither principal name is stored as user mail, nor mail property itself is filled - why user principle name is populated differently and why mail is not populated at all?

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments
{count} votes

Accepted answer
  1. AmanpreetSingh-MSFT 56,871 Reputation points Moderator
    2021-09-24T08:38:53.717+00:00

    Hi @Maria Senkiv • Thank you for reaching out.

    The email address that a user uses to signup for local account in Azure AD B2C, is stored as issuerAssignedId within identities attribute. You can use below graph call to see this property:

    Graph API V1 endpoint:

    Graph API beta endpoint:

    Reason why Azure AD B2C doesn't store it in the userPrincipalName or mail attribute is because these properties require the domain suffix to be added as Verified domain in the tenant. Which means, for a user to have username@example.com as userPrincipalName or mail, the domain example.com must be added as verified domain in that tenant and it is not possible to add & verify a custom domain if you do not own that domain.

    -----------------------------------------------------------------------------------------------------------

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.