| name | azure-storage-blob-rust |
| description | Azure Blob Storage SDK for Rust. Use for uploading, downloading, and managing blobs and containers. |
| risk | unknown |
| source | community |
| date_added | 2026-02-27 |
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>
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,
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,
)?;
container_client.create(None).await?;
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 —
DeveloperToolsCredential for dev, ManagedIdentityCredential for production
- Specify content length — required for uploads
- Use
RequestContent::from() — to wrap upload data
- Handle async operations — use
tokio runtime
- 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-only
Storage Blob Data Contributor — read/write
Storage Blob Data Owner — full access including RBAC
Reference Links
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.