将用户电子邮件映射到 ADO user/descriptor

Mapping user email to ADO user/descriptor

通过 git 提交,我可以访问作者和提交者的电子邮件,我希望将其映射到 Azure DevOps 中的用户。我在搜索时做了一些尽职调查,但我找不到任何具体的东西。我基本上已经达到了与下面post相同的状态:Getting user/users details based on user name/alias as parameter in azure devops

我在 Graph API 页面 (https://docs.microsoft.com/en-au/rest/api/azure/devops/graph/?view=azure-devops-rest-5.1) 上看到,这尚未得到官方支持。问题如下:有没有办法从简单的电子邮件中取回用户描述符?

Searching by UPN or Display Name

COMING SOON!

Often, identities are represented simply as display names such as Jamal Hartnett or UPNs such as jamal@contoso.com. These are not unique at any scope. Search is an resource that will take a text string and run a search across an account or project to find all potential matches. The more distinct the input, the better chance the resource will return a single result. The search resource will accept display names, aliases, UPNs, and email style strings such as Jamal Hartnett jamal@contoso.com.

如果提交作者的电子邮件与电子邮件推送的匹配,我可以使用其中的 IdentityRef 对象。但是对于其他不适用的情况,我不知道如何映射到描述符。

The problem is as follows: is there a way to get back a user descriptor from simply an email?

据我所知,官方RestAPI不支持通过邮件获取描述符。

但是根据我的测试,好像这个需求是可以的。

当您在 Organization Settings -> Users 中过滤用户时,您可以在 Browser Console tab 中获得此 Rest API。

休息API样本:

https://vsaex.dev.azure.com/Organization name/_apis/UserEntitlements?%24filter=name%20eq%20%27user@domain.com%27&%24&api-version=5.1-preview.3

然后你可以在 API 结果中得到用户描述符。

另外,官方RestAPI支持到list all user Graph。您也可以在结果中获得用户描述符。

希望对您有所帮助。