0

With a git commit, I have access to the author and committer's email and I wish to map that to a user in Azure DevOps. I've done some due diligence in searching this up but I cannot find anything concrete. I've basically reached the same state as the following post: Getting user/users details based on user name/alias as parameter in azure devops

I can see on the Graph API page (https://learn.microsoft.com/en-au/rest/api/azure/devops/graph/?view=azure-devops-rest-5.1) that this is not yet officially supported. The problem is as follows: is there a way to get back a user descriptor from simply an email?

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.

If the commit author email matches the pushed by email, I can use the IdentityRef object from that. But for other cases where this does not apply, I'm at a loss on how to map to a descriptor.

1 Answers1

1

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

As far as I know, the official Rest API doesn't support obtaining descriptors by email.

But based on my test, it seems that this requirement is available.

You could get this Rest API in Browser Console tab when you filter the user in Organization Settings -> Users.

enter image description here

Rest API sample:

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

Then you could get the user descriptor in the API result.

Descriptor

In addition , the official Rest API supports to list all user Graph. You could get the user descriptor in the result too.

Hope this helps.

Kevin Lu-MSFT
  • 20,786
  • 3
  • 19
  • 28
  • 1
    Thanks for the response! I think given how many users are in our organization, enumerating everything and parsing the results does not seem like a plausible option. This does seem to answer the problem posed though, despite its limitations. – ThingsAreBroken Jun 18 '20 at 02:12
  • Yes, this is only a temporary workaround. You can temporarily use this API and wait for the official rest api to launch. – Kevin Lu-MSFT Jun 18 '20 at 02:15