A simplified, modern .NET client library for Azure Blob Storage with built-in retry policies, comprehensive error handling, and intuitive APIs.
Simplified API - Easy-to-use wrapper around Azure.Storage.Blobs SDK Built-in Resilience - Automatic retry policies using Polly Comprehensive Operations - Upload, download, delete, copy, and more Streaming Support - Efficient handling of large files Container Management - Full CRUD operations for containers Metadata Management - Easy blob and container metadata handling Access Tier Management - Hot, Cool, and Archive tier support Lease Operations - Blob leasing for distributed locking SAS Token Generation - Secure delegated access Extensive Documentation - Full XML documentation for IntelliSense
dotnet add package AzureStorage.Standard.BlobsOr via Package Manager Console:
Install-Package AzureStorage.Standard.Blobsusing AzureStorage.Standard.Blobs;
using AzureStorage.Standard.Core;
var options = new StorageOptions
{
ConnectionString = "DefaultEndpointsProtocol=https;AccountName=..."
};
var blobClient = new AzureBlobClient(options);// Upload from file
await blobClient.UploadBlobAsync(
containerName: "documents",
blobName: "report.pdf",
filePath: "C:\\reports\\report.pdf"
);
// Upload from stream
using var stream = File.OpenRead("image.jpg");
await blobClient.UploadBlobAsync(
containerName: "images",
blobName: "profile.jpg",
content: stream
);// Download to file
await blobClient.DownloadBlobAsync(
containerName: "documents",
blobName: "report.pdf",
filePath: "C:\\downloads\\report.pdf"
);
// Download to stream
using var downloadStream = await blobClient.DownloadBlobToStreamAsync(
containerName: "images",
blobName: "profile.jpg"
);// Create container
await blobClient.CreateContainerIfNotExistsAsync("my-container");
// List containers
var containers = await blobClient.ListContainersAsync();
// Delete container
await blobClient.DeleteContainerAsync("my-container");var blobs = await blobClient.ListBlobsAsync(
containerName: "documents",
prefix: "reports/"
);
foreach (var blob in blobs)
{
Console.WriteLine($"Blob: {blob.Name}, Size: {blob.Size} bytes");
}// Set blob metadata
var metadata = new Dictionary<string, string>
{
{ "Author", "John Doe" },
{ "Department", "Engineering" }
};
await blobClient.SetBlobMetadataAsync("container", "document.pdf", metadata);
// Get blob metadata
var retrievedMetadata = await blobClient.GetBlobMetadataAsync("container", "document.pdf");// Change blob access tier
await blobClient.SetBlobAccessTierAsync(
containerName: "archives",
blobName: "old-data.zip",
accessTier: AccessTier.Archive
);// Copy blob within storage account
await blobClient.CopyBlobAsync(
sourceContainerName: "source-container",
sourceBlobName: "original.pdf",
destinationContainerName: "backup-container",
destinationBlobName: "backup-original.pdf"
);var sasToken = await blobClient.GenerateBlobSasTokenAsync(
containerName: "documents",
blobName: "report.pdf",
permissions: BlobSasPermissions.Read,
expiresOn: DateTimeOffset.UtcNow.AddHours(2)
);
// Use the SAS token
var sasUrl = $"https://mystorageaccount.blob.core.windows.net/documents/report.pdf?{sasToken}";var options = new StorageOptions
{
ConnectionString = "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=..."
};var options = new StorageOptions
{
AccountName = "myaccount",
AccountKey = "your-account-key"
};var options = new StorageOptions
{
ServiceUri = new Uri("https://myaccount.blob.core.windows.net")
};- .NET Standard 2.0
- .NET Standard 2.1
- .NET 8.0
- .NET 9.0
All operations throw AzureStorageException with detailed error information:
try
{
await blobClient.DownloadBlobAsync("container", "missing-file.pdf", "output.pdf");
}
catch (AzureStorageException ex)
{
Console.WriteLine($"Error: {ex.Message}");
Console.WriteLine($"Error Code: {ex.ErrorCode}");
Console.WriteLine($"Status Code: {ex.StatusCode}");
}- AzureStorage.Standard.Tables - Azure Table Storage client
- AzureStorage.Standard.Queues - Azure Queue Storage client
- AzureStorage.Standard.Files - Azure File Share client
For complete documentation, visit the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues, questions, or suggestions, please open an issue on GitHub.