【问题标题】:Azure CLI task "az sf cluster create" fails with hosted agentAzure CLI 任务“az sf cluster create”因托管代理而失败
【发布时间】:2017-11-12 08:35:18
【问题描述】:

以下命令基于我在官方文档中找到的一段代码 sn -p 创建 Linux Service Fabric 集群。

最初它是 bash 脚本,但在我的私有构建代理上不可用(需要 Windows Insider 程序??)所以我切换到批处理脚本。

不知道为什么下面的命令会失败:

d:\a\r1\a>call az sf cluster create --resource-group "ha17aztestclustergroup"  --location "westeurope"  --certificate-output-folder . --certificate-password "433q6D7sdNKkd-.,6ck@6"  --certificate-subject-name "ha17rsomaztestsf.cloudapp.azure.com"  --cluster-name "ha17aztestcluster"  --cluster-size 3 --os UbuntuServer1604 --vault-name "ha17rsomaztestkeyvault"  --vault-resource-group "ha17aztestclustergroup"  --vm-password $VmPassword --vm-user-name "sfadmin" 
ERROR: az sf cluster: error: argument subcommand: invalid choice: create
usage: az sf cluster [-h]
                      {select,manifest,code-version,config-version,health} ...

安装了 AZ CLI 2.0.20 的我的私有构建代理上确实可以使用完全相同的内联脚本

Azure 托管代理 (VS2017) 已安装 AZ CLI 2.0.14。
但我怀疑这就是问题所在。

【问题讨论】:

    标签: azure azure-devops azure-resource-manager azure-pipelines-release-pipeline azure-cli


    【解决方案1】:

    Hosted VS2017 已安装 Azure CLI 2.0.14,没有 create 命令用于 az sf cluster(2.0.21 包含),您可以通过添加 Azure CLI 使用z sf cluster --help 命令检查其命令的任务。

    因此,您可以设置一个私有构建代理并使用此代理进行构建。 Deploy an agent on Windows

    【讨论】:

      【解决方案2】:

      我在部署不同的资源(功能应用程序)时遇到了类似的问题。在比托管代理上安装的版本更高的版本中修复了错误。

      我最终解决了这个问题,要么将此命令动态注入到我的脚本中,要么只是在我的版本中添加一个额外的 Azure CLI 步骤来更新 Azure CLI

      pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge

      很遗憾,更新代理需要将近 5 分钟,但我的所有版本现在都是可靠的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-07-09
        • 2020-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多