question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: 'BlockBlobService' object has no attribute 'get_blob_client'

See original GitHub issue

This is autogenerated. Please review and update as needed.

Describe the bug

When use “az storage blob delete-batch” with an account key, the following error occures.

Command Name az storage blob delete-batch

Errors:

The command failed with an unexpected error. Here is the traceback:
'BlockBlobService' object has no attribute 'get_blob_client'
Traceback (most recent call last):
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 231, in invoke
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 658, in execute
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 713, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/__init__.py", line 409, in new_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/__init__.py", line 408, in new_handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 692, in _run_job
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 328, in __call__
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/operations/blob.py", line 709, in storage_blob_delete_batch
  File "D:\a\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/storage/util.py", line 33, in collect_blob_objects
AttributeError: 'BlockBlobService' object has no attribute 'get_blob_client'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az storage blob delete-batch --source {} --account-name {} --account-key {} --pattern {}

Expected Behavior

Environment Summary

Windows-10-10.0.22000-SP0
Python 3.10.4
Installer: MSI

azure-cli 2.36.0

Extensions:
account 0.2.1

Dependencies:
msal 1.17.0
azure-mgmt-resource 20.0.0

Additional Context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
calvinhzycommented, May 20, 2022

It should come as part of the release on 05/24/22.

1reaction
taiyokatocommented, May 2, 2022

Tested this at 2.30, 2.35, and 2.36. Worked fine prior to 2.36. 2.36 works too, only if passed a regex to --pattern (non-regex file name breaks)

Perhaps the the blob_service in this commit is supposed to be BaseBlobService instead of BlobServiceClient class? https://github.com/Azure/azure-cli/pull/22072/commits/39ba7483282f2e33b98473997ac2d872ab9d7cd1

https://github.com/evelyn-ys/azure-cli/blob/39ba7483282f2e33b98473997ac2d872ab9d7cd1/src/azure-cli/azure/cli/command_modules/storage/util.py#L33

Read more comments on GitHub >

github_iconTop Results From Across the Web

AttributeError: 'BlockBlobService' object has no attribute ...
So with a simple correction: from azure.storage.blob import BlockBlobService from azure.storage.file import ContentSettings blob_service ...
Read more >
azure.storage.blob.BlobServiceClient class | Microsoft Learn
A client to interact with the Blob Service at the account level. This client provides operations to retrieve and configure the account properties...
Read more >
How to List Blob, Download Blob from Azure Storage ...
My container has nested directories and files. The code iterate over all files and downloads one by one. Attributes of a Blob object....
Read more >
azure-storage-blob - PyPI
The Azure Storage Blobs client library for Python allows you to interact with each of these components through the use of a dedicated...
Read more >
Python BlockBlobService Examples, azurestorageblob ...
def update(self, area, selector, content_type, buffer): assert area is not None, 'area is none; should already be validated' area_config ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found