【问题标题】:How to use Azure DevOps Extension for Azure CLI with Azure DevOps Server?如何将 Azure DevOps Extension for Azure CLI 与 Azure DevOps Server 一起使用?
【发布时间】:2019-10-17 20:13:18
【问题描述】:

带有Azure DevOps extensionAzure CLI 已替换VSTS CLI。但是我找不到任何关于如何使用带有 Azure DevOps 扩展的 Azure CLI 连接到 Team Foundation Server (TFS) 或 Azure DevOps Server 的示例。

我尝试在我的 Azure DevOps 服务器上创建一个具有所有范围权限的 PAT。然后我使用以下命令登录:

az devops login --organization https://vm-dev-cgudevops/DefaultCollection --verbose

这是我得到的:

C:\>az devops login --organization https://vm-dev-cgudevops/DefaultCollection --verbose
Token:
Creating connection with personal access token.
Failed to authenticate using the supplied token.
Suppress exception There are no active accounts.
Suppress exception Please run 'az login' to setup account.
command ran in 25.138 seconds.

令牌不能错。不知道怎么回事。

【问题讨论】:

    标签: azure-devops azure-devops-extensions azure-devops-server-2019


    【解决方案1】:

    There 是 Azure DevOps 中的一个扩展,可让您从 Azure CLI 管理 Azure DevOps。

    正如扩展中提到的,你必须:

    1. 安装 Azure CLI。你必须至少有 v2.0.49,你可以 使用 az --version 命令进行验证。

    2. 添加 Azure DevOps 扩展 az extension add --name azure-devops

    3. 运行 az login 命令。

    您也可以找到它的示例here

    如果您需要有关如何开始使用它的更多信息,请阅读this 文章。

    【讨论】:

    • 我知道这些信息,但我仍然不知道如何登录 Azure DevOps Server。没有例子。所以我的问题是:1.如何登录?使用az loginaz devops login 或两者兼而有之? 2. 我试图在我的 Azure DevOps 服务器上创建一个 PAT 并使用az devops login --org myURL --verbose 登录,但我得到了Failed to authenticate using the supplied token.Suppress exception There are no active accounts. 的响应。
    【解决方案2】:

    目前 Azure DevOps 服务器不支持 Azure DevOps CLI。这基本上是由于 API 版本控制,因为 Azure DevOps 服务器在特定版本上运行,但 CLI 客户端始终更新到最新版本。因此,理想情况下,如果您使用的是最新版本的 Azure DevOps Server,那么 CLI 应该适合您,因为两者都使用相同的 API 版本。

    查看可用的文档 - https://docs.microsoft.com/en-us/azure/devops/cli/index?view=azure-devops

    【讨论】:

      【解决方案3】:

      Azure Cli 目前支持登录您的私有 TFS,请参阅:https://docs.microsoft.com/en-us/azure/devops/cli/log-in-via-pat?view=azure-devops&tabs=windows

      1. 创建 PAT
      2. 使用 PAT 登录,例如。 cat PAT.txt|az devops 登录 --organization http://your_tfs_url

      【讨论】:

        【解决方案4】:

        /tfs/DefaultCollection 添加到 URL。这对我有用。

        【讨论】:

          猜你喜欢
          • 2021-11-15
          • 2021-06-28
          • 1970-01-01
          • 2021-01-31
          • 2022-06-14
          • 1970-01-01
          • 2023-01-11
          • 2019-09-11
          • 2021-03-10
          相关资源
          最近更新 更多