Official Azure Blob Storage client library for Python. Current version: 12.28.0 (Mar 2026). v12 (released 2019) is a complete rewrite from v2.x — BlockBlobService removed, replaced by BlobServiceClient/ContainerClient/BlobClient. Most LLM training data and older tutorials use the removed v2 BlockBlobService API. Recommended auth is DefaultAzureCredential (azure-identity) not connection strings in production.
pip install azure-storage-blobVerified import paths — ran on the pinned version, not inferred.
azure-storage-blob v12 with DefaultAzureCredential upload/download.
from azure.storage.blob import BlobServiceClient — not BlockBlobService
blob_client.upload_blob(data) and blob_client.download_blob().readall()
from azure.storage.blob import generate_account_sas, ResourceTypes, AccountSasPermissions
blob_client.upload_blob(data, overwrite=True)
content = blob_client.download_blob().readall()
Ensure one of DefaultAzureCredential's underlying authentication methods is properly configured for your environment. This might involve setting environment variables (e.g., AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET), logging in via the Azure CLI (`az login`), or ensuring a Managed Identity is assigned and accessible to the resource running the code. Also, ensure 'azure-identity' is installed.
from azure.storage.blob.aio import BlobServiceClient for async usage.
Ensure the execution environment has valid credentials configured for DefaultAzureCredential to discover. For local development, log in via Azure CLI (`az login`). For Azure deployments, use Managed Identity, set environment variables, or ensure a Workload Identity is properly configured. Install 'azure-identity-broker' for Visual Studio Code credential support.