The `azure-storage-common` library provides common functionalities and utilities shared across the older Microsoft Azure Storage 'Track 1' client libraries for Python (e.g., `azure-storage-blob` v2.x, `azure-storage-queue` v2.x). It includes classes for managing storage accounts, shared access signatures, and handling exceptions. The current version is 2.1.0, with releases historically tied to new Azure Storage REST API versions, though it is now largely in maintenance mode.
pip install azure-storage-commonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `CloudStorageAccount` using a connection string. This object is the entry point for interacting with Azure Storage services when using the older Track 1 SDKs (v2.x of `azure-storage-blob`, `azure-storage-queue`, etc.). Ensure your Azure Storage connection string is set in the `AZURE_STORAGE_CONNECTION_STRING` environment variable.
For new projects or migrations, use the Track 2 SDK (e.g., `pip install azure-storage-blob` for v12.x+). Avoid mixing Track 1 and Track 2 in the same application.
Plan migration to the Track 2 SDKs (e.g., `azure-storage-blob` v12.x, `azure-storage-queue` v12.x, etc.) for future-proofing and access to new features.
Standardize on either the Track 1 or Track 2 SDK across your application. Prioritize Track 2 for new development.
Ensure the connection string exactly matches the format provided by the Azure portal or documented examples. Keys are case-sensitive.
Ensure the `AZURE_STORAGE_CONNECTION_STRING` environment variable is correctly set in your environment before running the application. Obtain the connection string from your Azure Storage account in the Azure portal.
Ensure the `AZURE_STORAGE_CONNECTION_STRING` environment variable is properly set in your environment with a valid Azure Storage connection string. Alternatively, pass the connection string directly to the `CloudStorageAccount` constructor or `create_from_connection_string` method.
Ensure `azure-common` and the specific `azure-storage-*` v2.x packages you intend to use are installed: `pip install azure-common azure-storage-blob==2.1.0` (adjust version as needed). If you intend to use the newer 'Track 2' SDK, uninstall older packages and install the appropriate v12.x packages, e.g., `pip uninstall azure-common azure-storage-blob` then `pip install azure-storage-blob==12.11.0` or later.
If you need to use the older `BlockBlobService`, explicitly install version 2.1.0 of `azure-storage-blob`: `pip install azure-storage-blob==2.1.0`. If you intend to use the modern SDK, update your code to use `BlobServiceClient` and other v12.x classes: `from azure.storage.blob import BlobServiceClient`.
Verify your installed Azure Storage packages (`pip list | grep azure-storage`). If you have both old (e.g., `azure-storage` or `azure-storage-blob` v2.x) and new (`azure-storage-blob` v12.x) packages, uninstall both and reinstall only the version you intend to use. If targeting v12.x, update your code to use the new client objects such as `BlobServiceClient`, `ContainerClient`, or `BlobClient`.
Double-check the validity and permissions of your SAS token, including its start and expiration times, and the services/resource types/permissions it grants. Regenerate the SAS token if necessary, ensuring it's correctly applied to the URL. Verify the storage account name and access keys are correct and active. For more secure authentication, consider using Azure Identity with managed identities or service principals.