Azure Storage SDK

Introduction and Quick Start

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:

Our SDKs are available for various popular programming languages and platforms, including:

Getting Started with the SDK

To begin using the Azure Storage SDK, you'll typically need to:

  1. Install the SDK package: Use your language's package manager (e.g., NuGet for .NET, pip for Python, npm for Node.js).
  2. Obtain connection information: You'll need your Azure Storage account name and either a connection string or access keys.
  3. Instantiate a client: Create a client object for the specific storage service you want to interact with (e.g., BlobServiceClient, QueueClient).
  4. 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

Explore the documentation for your preferred language to dive deeper into specific features and advanced usage patterns.

Explore Code Samples