az cmd "account clear" 在 "az storage blob upload-batch" 之后失败

az cmd "account clear" fails after "az storage blob upload-batch"

我在我的 tfs 发布管道中使用 azure cli 将前面构建管道的工件上传到 azure blob 存储。

使用的脚本如下:

az storage blob upload-batch --account-key $(Storage.Key) --account-name $(Storage.AccountName) -d $(Storage.Container)/$(Storage.SubFolder) -s $(System.DefaultWorkingDirectory)/myartefact/dist 

文件上传正常。但在完成后,它显然会尝试执行失败的 account clear 命令:

2020-06-15T11:28:57.2682530Z Finished[#############################################################] 100.0000%

2020-06-15T11:28:57.4557138Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" account clear"

2020-06-15T11:28:59.7995176Z ##[error]Script failed with error: Error: D:\w_temp\azureclitaskscript1592220526658.bat failed with return code: 0

2020-06-15T11:28:59.7995176Z ##[section]Finishing: Copy Files to Blob Storage

我不知道为什么执行这个命令,我也不知道为什么会失败。有什么想法吗?

您可以在未选中 Fail on Standard Error 选项的情况下尝试 运行 Azure CLI 任务。这可能是脚本正在向 stderr 流写入一些消息。

类似问题可以参考这个ticket