Warm tip: This article is reproduced from serverfault.com, please click

office365-“邮件”字段在图形 API 中没有唯一值

(office365 - "mail" field doesn't have unique values in Graph API)

发布于 2021-02-08 12:59:00

我们遇到了一个问题,即我们无法始终通过电子邮件地址可靠地识别用户,即多个用户可能具有相同的确切地址。这打破了我们软件中依赖于唯一地址的逻辑,我们有几个支持案例,这会给我们的客户带来问题。

When we query a user in Graph API we can see their "mail" property as shown:
{
"@odata.id": "https://graph.microsoft.com/v2/.../directoryObjects/.../Microsoft.DirectoryServices.User";,
"businessPhones": [],
"displayName": "dep1",
"givenName": "dep1",
"jobTitle": null,
"mail": "user1@company.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "dep1@company.onmicrosoft.com",
"id": "<unique GUID 1>"
}

https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0我们了解到“邮件”返回主 SMTP,它应该是唯一的。

但是,如果你将用户从本地迁移到云,你将看到该用户具有相同的“邮件”字段:

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users";,
"value": [
{
"@odata.id": "https://graph.microsoft.com/v2/.../directoryObjects/.../Microsoft.DirectoryServices.User";,
"businessPhones": [],
"displayName": "ev1",
"givenName": "ev1",
"jobTitle": null,
"mail": "user1@company.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "user12345@company.onmicrosoft.com",
"id": "<unique GUID 2>"
},

根据这篇文章:https : //support.microsoft.com/en-us/topic/how-to-use-smtp-matching-to-match-on-premises-user-accounts-to-office-365-user -accounts-for-directory-synchronization-75673b94-e1b8-8a9e-c413-ee5a2a1a6a78#:~:text=The%20cloud%20user%27s%20primary%20SMTP,have%20the%20same%20SMTP%20address this should not be allowed或者不应该发生?也许它描述了一个不同的场景。

因此,我们现在有两个用户具有相同的“邮件”字段,预计具有唯一值。为什么“邮件”不是唯一的?我们应该怎么做,或者我们应该使用什么作为用户的唯一 SMTP 地址?也许来自“proxyAddresses”字段的一些值如下所示?

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,displayName,userPrincipalName,onPremisesSecurityIdentifier,mail,proxyAddresses,officeLocation,assignedPlans)/$entity";,
"id": "<unique GUID 1>",
"displayName": "dep1",
"userPrincipalName": "dep1@company.onmicrosoft.com",
"onPremisesSecurityIdentifier": null,
"mail": "user1@company.com",
"proxyAddresses": [
"SMTP:user1@company.com",
"smtp:dep1@company.onmicrosoft.com"
],
"officeLocation": null,
"assignedPlans": [
{

谢谢!

Questioner
vzubarev
Viewed
0
vzubarev 2021-02-17 21:01:38

MS 支持已澄清,虽然这种情况是可能的,但这是他们计划修复的 Azure AD 中的错误。