Welcome to the Azure Storage SDK
The Azure Storage SDKs provide a powerful and flexible way to interact with Azure Storage services from your applications. Whether you're building a cloud-native application, migrating an existing workload, or developing a mobile app, our SDKs offer robust features and intuitive APIs to manage your data.
What are Azure Storage SDKs?
Azure Storage offers several types of storage services:
- Blob Storage: Scalable object storage for unstructured data like documents, images, videos, and backups.
- File Storage: Fully managed cloud file shares accessible via the industry-standard Server Message Block (SMB) protocol.
- Queue Storage: A service for storing large numbers of messages that can be accessed from anywhere in the world.
- Table Storage: A NoSQL key-attribute store for structured non-relational data.
Our SDKs are available for various popular programming languages and platforms, including:
- .NET
- Java
- Python
- JavaScript/TypeScript
- Go
- C++
Getting Started with the SDK
To begin using the Azure Storage SDK, you'll typically need to:
- Install the SDK package: Use your language's package manager (e.g., NuGet for .NET, pip for Python, npm for Node.js).
- Obtain connection information: You'll need your Azure Storage account name and either a connection string or access keys.
- Instantiate a client: Create a client object for the specific storage service you want to interact with (e.g., BlobServiceClient, QueueClient).
- Perform operations: Use the client to perform operations like uploading/downloading files, sending/receiving messages, or querying tables.
Example: Uploading a Blob (Python)
Here's a simple example demonstrating how to upload a blob to Azure Blob Storage using the Python SDK:
from azure.storage.blob import BlobServiceClient
# Replace with your actual connection string
connect_str = "YOUR_AZURE_STORAGE_CONNECTION_STRING"
container_name = "my-container"
local_file_name = "local_file.txt"
blob_name = "remote_blob_name.txt"
try:
# Create the BlobServiceClient object
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
# Get a client to interact with a specific container
container_client = blob_service_client.get_container_client(container_name)
# Create a local file for demonstration
with open(local_file_name, "w") as my_file:
my_file.write("This is a sample file to upload.")
# Upload the blob
with open(local_file_name, "rb") as data:
blob_client = container_client.upload_blob(name=blob_name, data=data, overwrite=True)
print(f"Blob '{blob_name}' uploaded successfully.")
except Exception as ex:
print('Exception: {}'.format(ex))
Key Features
- Asynchronous Operations: Many SDKs offer asynchronous APIs for improved performance and responsiveness.
- Error Handling: Comprehensive error handling and exceptions for robust applications.
- Retry Policies: Built-in retry mechanisms to handle transient network issues.
- Cross-Platform Compatibility: Works across various operating systems and environments.
- Security: Support for various authentication methods, including shared key, Shared Access Signatures (SAS), and Azure Active Directory.
Explore the documentation for your preferred language to dive deeper into specific features and advanced usage patterns.
Explore Code Samples