Azure Storage Services
Azure Storage provides secure, scalable, durable cloud storage for a variety of data objects: blobs, files, queues, and tables.
Overview
Choose the right storage type based on your workload:
- Blob: Object storage for unstructured data.
- File: Fully managed file shares accessible via SMB.
- Queue: Messaging service for asynchronous communication.
- Table: NoSQL key‑value store for fast lookups.
Blob Storage
Store massive amounts of unstructured data such as images, videos, logs, and backups.
Usage
Tiering
Security
Blob types:
- Block blobs – optimized for streaming and random reads.
- Append blobs – ideal for logs.
- Page blobs – used for virtual hard disks.
Access tiers:
- Hot – frequently accessed data.
- Cool – infrequently accessed.
- Archive – rarely accessed, long‑term storage.
Features:
- Encryption at rest & in transit.
- Shared Access Signatures (SAS).
- Azure AD authentication.
File Storage
Fully managed file shares accessible via SMB protocol.
az storage share create \
--name myshare \
--account-name mystorageaccount
Queue Storage
Reliable messaging for decoupled application components.
queue_client = QueueClient.from_connection_string(conn_str, "myqueue")
queue_client.send_message("Hello, Azure Queue!")
Table Storage
Key‑value NoSQL store for rapid lookups.
table_service = TableServiceClient.from_connection_string(conn_str)
entity = {"PartitionKey": "pk", "RowKey": "rk", "Data": "Sample"}
table_service.create_entity(table_name="mytable", entity=entity)
Pricing
Pricing varies by storage type, redundancy, and access tier. Use the Azure Pricing Calculator to estimate costs.
Service | Redundancy | Pricing (per GB/month) |
---|---|---|
Blob | Locally‑redundant (LRS) | $0.0184 (Hot) |
File | Zone‑redundant (ZRS) | $0.024 |
Queue | Read‑access geo‑redundant (RA‑GRS) | $0.0075 |
Table | LRS | $0.006 |
Getting Started
- Create a storage account via Azure Portal or CLI.
- Configure networking and firewalls.
- Choose a storage service and create the resource.
- Integrate using Azure SDKs or REST APIs.
az storage account create \
--name mystorageaccount \
--resource-group MyResourceGroup \
--location eastus \
--sku Standard_LRS
Code Samples
Select a language to view sample code:
Python
C#
JavaScript
from azure.storage.blob import BlobServiceClient
conn_str = "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=core.windows.net"
blob_service = BlobServiceClient.from_connection_string(conn_str)
container_client = blob_service.get_container_client("mycontainer")
blob_client = container_client.get_blob_client("sample.txt")
blob_client.upload_blob(b"Hello, Azure Blob!", overwrite=True)
var blobServiceClient = new BlobServiceClient(connectionString);
var containerClient = blobServiceClient.GetBlobContainerClient("mycontainer");
var blobClient = containerClient.GetBlobClient("sample.txt");
await blobClient.UploadAsync(new BinaryData("Hello, Azure Blob!"), overwrite:true);
const { BlobServiceClient } = require("@azure/storage-blob");
const blobServiceClient = BlobServiceClient.fromConnectionString(process.env.AZURE_STORAGE_CONNECTION_STRING);
const containerClient = blobServiceClient.getContainerClient("mycontainer");
const blockBlobClient = containerClient.getBlockBlobClient("sample.txt");
await blockBlobClient.uploadData(Buffer.from("Hello, Azure Blob!"));