Azure Storage libraries for Python

Overview

Create, update, and manage Azure Storage accounts and query and regenerate access keys from your Python code with the management libraries.

Install the libraries

Client

Azure Storage Client Libraries consist of 4 packages: Blob, File, Queue and Table. To install the blob package, run:

pip install azure-storage-blob

Management

pip install azure-mgmt-storage

Example

from azure.storage.blob import BlockBlobService

blob_service = BlockBlobService(account_name, account_key)

blob_service.create_container(
    'mycontainername',
    public_access=PublicAccess.Blob
)

blob_service.create_blob_from_bytes(
    'mycontainername',
    'myblobname',
    b'<center><h1>Hello World!</h1></center>',
    content_settings=ContentSettings('text/html')
)

print(blob_service.make_blob_url('mycontainername', 'myblobname'))

Samples

Get started with Azure Blob Storage in Python Create, read, update, restrict access, and delete files and objects in Azure Storage.
Get started with Azure Queue Storage in Python Insert, peek, retrieve and delete messages from Azure Storage queues.
Manage Azure Storage accounts Create, update , and delete storage accounts. Retrieve and regenerate storage account access keys.

Explore more sample Python code you can use in your apps.