azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

"Could not resolve identity" when required reviewers is distribution list

Open dagett opened this issue 5 years ago • 2 comments

Describe the bug

When trying to create a branch policy with required reviewers:

$ az repos policy required-reviewer create ... --required-reviewer-ids [email protected]

fails with

Could not resolve identity: [email protected]

The email-address (placeholder above) is a distribution list in Outlook containing 12 email addresses. If I re-run the command with a regular email address the command works OK.

Command Name `az repos policy required-reviewer create

Extension Name: azure-devops. Version: 0.17.0.`

Errors:

Could not resolve identity: [email protected]

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • organisation, project, repo, branch must exist and you must have the required access rights.
  • az repos policy required-reviewer create --project {} --repository-id {} --branch {} --enabled true --blocking true --message "please review this" --required-reviewer-ids [email protected]

Expected Behavior

A JSON object that describes the new policy is returned. No errors.

Environment Summary

Linux-5.3.0-51-generic-x86_64-with-debian-buster-sid
Python 3.6.5
Installer: DEB

azure-cli 2.6.0 *

Extensions:
azure-devops 0.17.0

Additional Context

Reading from these docs . I have used the regular email address (at-format) of the distribution list, not the Pretty Long Name

Running with -debug shows that nothing is returned on lookup of email-address:

...
urllib3.connectionpool : https://vssps.dev.azure.com:443 "GET /FOO/_apis/Identities?searchFilter=General&filterValue=xyz%40abc.com HTTP/1.1" 200 143
azext_devops.devops_sdk.client : Response content: b'{"count":0,"value":[]}'
azext_devops.devops_sdk.client : Route template: _apis/{resource}/{identityId}
azext_devops.devops_sdk.client : Api version '5.0'
azext_devops.devops_sdk.client : GET https://vssps.dev.azure.com/FOO/_apis/Identities?searchFilter=DirectoryAlias&filterValue=xyz%40abc.com
azext_devops.devops_sdk.client : Request content: None

dagett avatar Jun 08 '20 13:06 dagett

same issue

QimatLuo avatar May 27 '21 11:05 QimatLuo

I was able to make this work without specifying the domain name if i was using my own identity. For example if the cli is failing with this error message for [email protected] try using only myemaillist, it worked for me.

However when running this with a managed identity or devops token, it failed with a different error:

ERROR: The requested resource requires user authentication: https://myproject.vssps.visualstudio.com/_apis/Identities?searchFilter=DirectoryAlias&filterValue=mydummyidentity

ksumit avatar Jun 09 '21 22:06 ksumit