Skip to content

Instantly share code, notes, and snippets.

@RachidAZ
Created January 16, 2022 22:45
Show Gist options
  • Save RachidAZ/106f578d91b02f78629e2e65e8ae83ec to your computer and use it in GitHub Desktop.
Save RachidAZ/106f578d91b02f78629e2e65e8ae83ec to your computer and use it in GitHub Desktop.
upload file as a blob to Azure storage account using python
from azure.storage.blob.aio import BlobClient
account_name = "{account_name}"
target_conn_str = "{connection_string}"
target_container_name = "{container_name}"
target_blob_name = "{file_to_upload}"
blob = BlobClient.from_connection_string(conn_str=target_conn_str, container_name=target_container_name, blob_name= target_blob_name)
with open(target_blob_name, "rb") as data:
await blob.upload_blob(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment