错误:请求的资源需要用户身份验证:https://dev.azure.com/my_org/my_project/_apis/git/repositories

发布于 2025-01-17 12:27:38 字数 436 浏览 4 评论 0原文

我正在使用正确的令牌登录 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

海的爱人是光 2025-01-24 12:27:38

如果您已设置 AZURE_DEVOPS_EXT_PAT 环境变量,则不想使用 az devops 登录。如果您未设置 AZURE_DEVOPS_EXT_PAT 环境变量,请先设置它并执行 CLI 任务。

az devops 命令现在支持使用 az login 登录,如果您已经使用 登录,则无需提供令牌az login 以交互方式或使用用户名和密码。但是,您无法使用 az login 作为服务主体登录。在这种情况下,需要 PAT。

如果您仍然需要使用 az devops login登录,则需要用户身份验证< /strong>。为此,您必须使用服务原理

 "user": {
    "name": "***",
    "type": "servicePrincipal"
  }

参考

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 with az login, you don't need to give a token if you've already signed in with az login interactively or with a username and password. However, you can't use az 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

 "user": {
    "name": "***",
    "type": "servicePrincipal"
  }

References

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文