BlobServiceClient 对象没有属性“exists”

BlobServiceClient object has no attribute `exists`

我创建了一条天蓝色管道。添加了从 blobStorage 下载文件的任务。

但是我收到以下错误:

ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: 'BlobServiceClient' object has no attribute 'exists' Traceback (most recent call last):
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 658, in execute
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 721, in _run_jobs_serially
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 713, in _run_job
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/init.py", line 385, in new_handler
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/init.py", line 385, in new_handler
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/_exception_handler.py", line 17, in file_related_exception_handler
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 692, in _run_job
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 328, in call
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/blob.py", line 363, in storage_blob_download_batch
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/util.py", line 16, in collect_blobs
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/util.py", line 16, in
File "D:\a\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/util.py", line 31, in collect_blob_objects
AttributeError: 'BlobServiceClient' object has no attribute 'exists' To open an issue, please run: 'az feedback'
##[error]PowerShell exited with code '1'.\

在任务中编写的内联脚本:

az storage blob download-batch --destination $(build.sourcesDirectory) --pattern $(jmxfile) -s $(jmeter-storagecontainer) --account-name $(az-storageaccount) --account-key '$(az-accountkey)' --connection-string '$(az-connstring)'

我已验证所有变量值均正确且 jmxfile 模式也正确。

知道吗,为什么会出现这个 BlobServiceClient Object has no attribute 'exists' 错误?

错误 “BlobServiceClient 对象没有属性 'exists'” 如果您使用的是 az cli 最新版本 并执行 az storage blob download-batch 命令。

  • 要解决该错误,请尝试使用 az storage blob download 作为解决方法。
  • 否则,尝试通过卸载 Azure cli 最新版本安装以前的版本
  • 确保在执行上述步骤时删除所有最新版本的依赖项
  • 请注意--pattern参数只支持四种情况

  • 请注意,在 最新的 CLI.
  • 中存在处理完整 blob 名称的错误

请查看下面的 GitHub 博客,它证实了上述问题:

Latest az cli fails to run download-batch command · Issue #21966 · Azure/azure-cli · GitHub