Azure's Graph API supports fetching details of a user using this API. It supports either the id or the userPrincipalName(UPN). For B2B user the requirement is to fetch the details using UPN. The UPN that Azure creates for a B2B user is the following format "B2BUserEmail#EXT#directoryid/Tenant"
When queried with above UPN format
https://graph.microsoft.com/v1.0/users/b2buseremail.com#EXT#@<directory/tenant>
the REST API fails and gives the following error
{
"error": {
"code": "Request_ResourceNotFound",
"message": "Resource 'b2buseremail.com' does not exist or one of its queried reference-property objects are not present.",
"innerError": {
"request-id": "d167220f-e0ef-4528-b7a5-de71fd524f07",
"date": "2019-12-09T23:52:18"
}
}
}