Azure Blob Storage SDK for Rust
Client library for Azure Blob Storage — Microsoft's object storage solution for the cloud.
Installation
cargo add azure_storage_blob azure_identity
Environment Variables
AZURE_STORAGE_ACCOUNT_NAME=<storage-account-name>
# Endpoint: https://<account>.blob.core.windows.net/
Authentication
use azure_identity::DeveloperToolsCredential;
use azure_storage_blob::{BlobClient, BlobClientOptions};
let credential = DeveloperToolsCredential::new(None)?;
let blob_client = BlobClient::new(
"https://<account>.blob.core.windows.net/",
"container-name",
"blob-name",
Some(credential),
Some(BlobClientOptions::default()),
)?;
Client Types
| Client | Purpose |
BlobServiceClient | Account-level operations, list containers |
BlobContainerClient | Container operations, list blobs |
BlobClient | Individual blob operations |
Core Operations
Upload Blob
use azure_core::http::RequestContent;
let data = b"hello world";
blob_client
.upload(
RequestContent::from(data.to_vec()),
false, // overwrite
u64::try_from(data.len())?,
None,
)
.await?;
Download Blob
let response = blob_client.download(None).await?;
let content = response.into_body().collect_bytes().await?;
println!("Content: {:?}", content);
Get Blob Properties
let properties = blob_client.get_properties(None).await?;
println!("Content-Length: {:?}", properties.content_length);
Delete Blob
blob_client.delete(None).await?;
Container Operations
use azure_storage_blob::BlobContainerClient;
let container_client = BlobContainerClient::new(
"https://<account>.blob.core.windows.net/",
"container-name",
Some(credential),
None,
)?;
// Create container
container_client.create(None).await?;
// List blobs
let mut pager = container_client.list_blobs(None)?;
while let Some(blob) = pager.try_next().await? {
println!("Blob: {}", blob.name);
}
Best Practices
- Use Entra ID auth —
DeveloperToolsCredentialfor dev,ManagedIdentityCredentialfor production - Specify content length — required for uploads
- Use
RequestContent::from()— to wrap upload data - Handle async operations — use
tokioruntime - Check RBAC permissions — ensure "Storage Blob Data Contributor" role
RBAC Permissions
For Entra ID auth, assign one of these roles:
Storage Blob Data Reader— read-onlyStorage Blob Data Contributor— read/writeStorage Blob Data Owner— full access including RBAC
Reference Links
| Resource | Link |
| API Reference | https://docs.rs/azure_storage_blob |
| Source Code | https://github.com/Azure/azure-sdk-for-rust/tree/main/sdk/storage/azure_storage_blob |
| crates.io | https://crates.io/crates/azure_storage_blob |
Skill Information
- Source
- Microsoft
- Category
- Cloud & Azure
- Repository
- View on GitHub
Related Skills
agent-framework-azure-ai-py
Build Azure AI Foundry agents using the Microsoft Agent Framework Python SDK (agent-framework-azure-ai). Use when creating persistent agents with AzureAIAgentsProvider, using hosted tools (code interpreter, file search, web search), integrating MCP servers, managing conversation threads, or implementing streaming responses. Covers function tools, structured outputs, and multi-tool agents.
Microsoftazd-deployment
Deploy containerized applications to Azure Container Apps using Azure Developer CLI (azd). Use when setting up azd projects, writing azure.yaml configuration, creating Bicep infrastructure for Container Apps, configuring remote builds with ACR, implementing idempotent deployments, managing environment variables across local/.azure/Bicep, or troubleshooting azd up failures. Triggers on requests for azd configuration, Container Apps deployment, multi-service deployments, and infrastructure-as-code with Bicep.
Microsoftazure-ai-agents-persistent-dotnet
Azure AI Agents Persistent SDK for .NET. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Use for agent CRUD, conversation threads, streaming responses, function calling, file search, and code interpreter. Triggers: "PersistentAgentsClient", "persistent agents", "agent threads", "agent runs", "streaming agents", "function calling agents .NET".
Microsoftazure-ai-agents-persistent-java
Azure AI Agents Persistent SDK for Java. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools. Triggers: "PersistentAgentsClient", "persistent agents java", "agent threads java", "agent runs java", "streaming agents java".
Microsoftazure-ai-anomalydetector-java
Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate/multivariate anomaly detection, time-series analysis, or AI-powered monitoring.
Microsoft