错误:请求的资源需要用户身份验证:https://dev.azure.com/my_org/my_project/_apis/git/repositories
我正在使用正确的令牌登录 az cli: 回显 my_pat | az devops login
但在获取项目中的现有存储库时,我看到以下错误:
az repos list --org {ado_org_url} --project {ado_project} --query '[*].name'
错误:请求的资源需要用户身份验证:https://dev.azure.com/my_org/my_project/\_apis/git/repositories
我在设置 pat 时是否缺少任何设置?我怎样才能摆脱这个错误?
I am logging into az cli using correct token:echo my_pat | az devops login
But I see the following error while getting the existing repositories in a project:
az repos list --org {ado_org_url} --project {ado_project} --query '[*].name'
ERROR: The requested resource requires user authentication: https://dev.azure.com/my_org/my_project/\_apis/git/repositories
Am I missing any settings while setting up my pat? How can I get rid of this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您已设置 AZURE_DEVOPS_EXT_PAT 环境变量,则不想使用 az devops 登录。如果您未设置 AZURE_DEVOPS_EXT_PAT 环境变量,请先设置它并执行 CLI 任务。
az devops
命令现在支持使用az login
登录,如果您已经使用登录,则无需提供令牌az login
以交互方式或使用用户名和密码。但是,您无法使用az login
作为服务主体登录。在这种情况下,需要 PAT。如果您仍然需要使用 az devops login 来登录,则需要用户身份验证< /strong>。为此,您必须使用服务原理
参考
You don't want to use the az devops login if you already set an AZURE_DEVOPS_EXT_PAT Environment Variable. If you not set an AZURE_DEVOPS_EXT_PAT Environment Variable set it first and do your CLI Task.
The
az devops
commands now enable sign-in withaz login
, you don't need to give a token if you've already signed in withaz login
interactively or with a username and password. However, you can't useaz login
to log in as the service principal. A PAT is required in that case.If you still need to log in by using az devops login it requires the User Authentication. For that, you have to login using Service Principle
References