Azure的Graph API支持使用this API获取用户的详细信息。它支持id或userPrincipalName(UPN)。对于B2B用户,要求是使用UPN获取详细信息。 Azure为B2B用户创建的UPN为以下格式“ B2BUserEmail#EXT#directoryid / Tenant”
以上述UPN格式查询时
https://graph.microsoft.com/v1.0/users/b2buseremail.com#EXT#@<directory/tenant>
REST API失败,并出现以下错误
{
"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"
}
}
}
[当前,Azure Graph API将“#”视为特殊字符,因此他们建议使用“%23”而不是“#”
所以查询看起来像
https://graph.microsoft.com/v1.0/users/b2buseremail.com%23EXT%23@<directory/tenant>