【问题标题】:Running az cli command in Azure DevOps在 Azure DevOps 中运行 az cli 命令
【发布时间】:2019-07-05 03:34:00
【问题描述】:

我想自动将文件传输到我的 Azure 存储中。我正在使用以下脚本。

az storage account keys list -g ****V2 -n *****estx
az storage blob upload-batch --source $(System.DefaultWorkingDirectory)/_ClientWeb-Build-CI/ShellArtifact/out/build --destination `$web --account-key *****agnqUDzwNe/gOIAzsQ== --account-name *****estx

这可行,但我不想添加--acount-key。当我尝试使用 az storage account keys list 检索帐户密钥时,我得到:

请运行“az login”来设置帐户。

我正在使用 Azure PowerShell(预览版)任务版本 4。

如何用生成的内容替换我当前的帐户密钥?

【问题讨论】:

  • 使用 az cli 任务而不是 powershell 任务。

标签: azure azure-devops


【解决方案1】:

运行Azure Powershell 任务将使用Connect-AzAccount 进行身份验证

您应该使用Azure Cli 任务。它将使用az login 进行身份验证。

【讨论】:

  • 我试过了,但是运行 az storage blob upload-batch 返回 The specifed resource name contains invalid characters. ErrorCode: InvalidResourceName 而在 Azure Powershell 中这条线工作正常。
  • 你能在字符串参数周围加一些引号吗?
  • '$web。将其更改为 $web 修复了上述问题。
猜你喜欢
  • 1970-01-01
  • 2020-03-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-27
  • 2021-11-26
  • 2021-11-26
  • 2020-04-02
相关资源
最近更新 更多