Skip to content

azure.storage.blob.ContainerClient() initializer does not support emulated blob storage from Azurite #12568

@chrisyeh96

Description

@chrisyeh96
  • Package Name: azure-storage-blob
  • Package Version: 12.3.2
  • Operating System: Windows 10 Version 10.0.19041 Build 19041, running WSL 1
  • Python Version: 3.8.3

Describe the bug
azure.storage.blob.ContainerClient() throws errors on emulated local blob storage.

To Reproduce
Steps to reproduce the behavior:

from azure.storage.blob import ContainerClient
ContainerClient(
    account_url='http://127.0.0.1:1000/devstoreaccount1',
    container_name='newcontainer',
    credential='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==')

Running Code in Python REPL:

>>> from azure.storage.blob import ContainerClient
>>> ContainerClient(
...     account_url='http://127.0.0.1:1000/devstoreaccount1',
...     container_name='newcontainer',
...     credential='Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cyeh/miniconda3/envs/env/lib/python3.8/site-packages/azure/storage/blob/_container_client.py", line 150, in __init__
    super(ContainerClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs)
  File "/home/cyeh/miniconda3/envs/env/lib/python3.8/site-packages/azure/storage/blob/_shared/base_client.py", line 90, in __init__
    self.credential = format_shared_key_credential(account, credential)
  File "/home/cyeh/miniconda3/envs/env/lib/python3.8/site-packages/azure/storage/blob/_shared/base_client.py", line 330, in format_shared_key_credential
    raise ValueError("Unable to determine account name for shared key credential.")
ValueError: Unable to determine account name for shared key credential.
>>>

Expected behavior

There should not be any error. Both Azurite and the Azure storage emulator assume the 'http://127.0.0.1:1000/devstoreaccount1' account URL, but it seems like the Azure Python SDK sadly does not support this.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Service AttentionWorkflow: This issue is responsible by Azure service team.StorageStorage Service (Queues, Blobs, Files)customer-reportedIssues that are reported by GitHub users external to the Azure organization.feature-requestThis issue requires a new behavior in the product in order be resolved.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions