from azure.storage.blob import BlobServiceClient, ContentSettings
ImportError: cannot import name 'BlobServiceClient' from 'azure.storage.blob'
In azure automation I deployed my code and test pane it/run the code faced the errors
In requirements I am using azure-storage-blob==12.20.0
I am using in azure automation editor and my python code in (python version 3.8)
still I am facing the above error
Recognized by Microsoft Azure Collective
New contributor
Bandaru Prudhvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
0
- In order to use
azure.storage.blob
in Azure automation, you need to addazure-storage-blob
andazure-core
packages to it. - Download the .whl files for both the packages by navigating to
pypi.org
site as shown below.
- Then import it by navigation to Python Packages blade in your Automation account.
- By performing the above steps, I am able to execute the given code.
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient
container = ContainerClient.from_connection_string(conn_str="{connectionString}", container_name="sample-container")
blob_list = container.list_blobs()
for blob in blob_list:
print(blob.name + 'n')
print("Test Completed..")
Recognized by Microsoft Azure Collective
3