Muokkaa

Jaa


Azure Storage samples using Python client libraries

This article provides an overview of code sample scenarios found in our developer guides and samples repository. Click on the links to view the corresponding samples, either in our developer guides or in GitHub repositories.

Developer guides are collections of articles that provide detailed information and code examples for specific scenarios related to Azure Storage services. To learn more about the Blob Storage developer guide for Python, see Get started with Azure Blob Storage and Python.

Note

These samples use the latest Azure Storage Python v12 library. For legacy v2.1 code, see Azure Storage: Getting Started with Azure Storage in Python in the GitHub repository.

Blob samples

The following table links to Azure Blob Storage developer guides and samples that use Python client libraries:

Topic Developer guide Samples on GitHub
Authentication/authorization Authorize access and connect to Blob Storage

Create a user delegation SAS for a blob

Create a service SAS for a blob

Create an account SAS
Create blob service client using Azure Identity

Create blob service client using a connection string

Create blob service client using a shared access key

Create blob client from URL

Create blob client SAS URL

Create blob service client using ClientSecretCredential

Create SAS token
Create container Create a container Create container

Create container client using SAS URL

Create container using container client
Upload Upload a blob Upload a blob

Upload blob to container
Download Download a blob Download a blob
List List containers

List blobs
List containers

List blobs in container
Delete Delete containers

Delete blobs
Delete container using service client

Delete container using container client

Delete blob

Delete multiple blobs

Undelete blob
Copy Overview of copy operations

Copy a blob from a source object URL

Copy a blob with asynchronous scheduling
Copy blob from URL

Abort copy blob from URL
Lease Create and manage container leases

Create and manage blob leases
Acquire lease on container

Acquire lease on blob
Properties and metadata Manage container properties and metadata

Manage blob properties and metadata
Get container properties

Set container metadata

Get blob properties
Index tags Use blob index tags to manage and find data
Access tiers Set or change a block blob's access tier
Blob service Get blob service account info

Set blob service properties

Get blob service properties

Get blob service stats
Access policy Set container access policy

Get container access policy

Data Lake Storage samples

The following table links to Azure Data Lake Storage samples that use Python client libraries:

Topic Samples on GitHub
Data Lake service Create Data Lake service client
File system Create file system client
Delete file system
Directory Create directory client
Get directory permissions
Set directory permissions
Rename directory
Get directory properties
Delete directory
File Create file client
Create file
Get file permissions
Set file permissions
Append data to file
Read data from file

Azure File samples

The following table links to Azure File samples that use Python client libraries:

Topic Samples on GitHub
Authentication Create share service client from connection string
Create share service client from account and access key
Generate SAS token
File service Set service properties
Get service properties
Create shares using file service client
List shares using file service client
Delete shares using file service client
File share Create share client from connection string
Get share client
Create share using file share client
Create share snapshot
Delete share using file share client
Set share quota
Set share metadata
Get share properties
Directory Create directory
Upload file to directory
Delete file from directory
Delete directory
Create subdirectory
List directories and files
Delete subdirectory
Get subdirectory client
List files in directory
File Create file client
Create file
Upload file
Download file
Delete file
Copy file from URL

Queue samples

The following table links to Azure Queues samples that use Python client libraries:

Topic Samples on GitHub
Authentication Authenticate using connection string
Create queue service client token
Create queue client from connection string
Generate queue client SAS token
Queue service Create queue service client
Set queue service properties
Get queue service properties
Create queue using service client
Delete queue using service client
Queue Create queue client
Set queue metadata
Get queue properties
Create queue using queue client
Delete queue using queue client
List queues
Get queue client
Message Send messages
Receive messages
Peek message
Update message
Delete message
Clear messages
Set message access policy

Table samples

The following list links to Azure Table samples that use Python client libraries:

Samples for deprecated client libraries are available at Azure Table Storage samples for Python.

Azure code sample libraries

To view the complete Python sample libraries, go to:

You can browse and clone the GitHub repository for each library.

Getting started guides

Check out the following guides if you're looking for instructions on how to install and get started with the Azure Storage client libraries.

Next steps

For information on samples for other languages: