devdeer.Libraries.Azure.BlobStorage
0.7.0
dotnet add package devdeer.Libraries.Azure.BlobStorage --version 0.7.0
NuGet\Install-Package devdeer.Libraries.Azure.BlobStorage -Version 0.7.0
<PackageReference Include="devdeer.Libraries.Azure.BlobStorage" Version="0.7.0" />
<PackageVersion Include="devdeer.Libraries.Azure.BlobStorage" Version="0.7.0" />
<PackageReference Include="devdeer.Libraries.Azure.BlobStorage" />
paket add devdeer.Libraries.Azure.BlobStorage --version 0.7.0
#r "nuget: devdeer.Libraries.Azure.BlobStorage, 0.7.0"
#:package devdeer.Libraries.Azure.BlobStorage@0.7.0
#addin nuget:?package=devdeer.Libraries.Azure.BlobStorage&version=0.7.0
#tool nuget:?package=devdeer.Libraries.Azure.BlobStorage&version=0.7.0
devdeer.Libraries.Azure.BlobStorage
Disclaimer
If you want to use this package you should be aware of some principles and practices we at DEVDEER use. So be aware that this is not backed by a public repository. The purpose here is to give out customers easy access to our logic. Nevertheless, you are welcome to use this lib if it provides any advantages.
Summary
This package is designed to simplify interactions with Azure Blob Storage. It provides an abstraction layer over the Azure SDK, making it easier to perform common blob operations. It is primarily intended for internal DEVDEER projects, but it can be useful for any .NET-based application that integrates with Azure Storage.
Key Features:
- Simplified API for working with Azure Blob Storage.
- Extensions methods for common operations.
- Helper classes.
- Asynchronous support using Task-based methods.
- Configurable authentication.
- Logging integration with .NET's built-in logging framework.
To use this library, follow these steps:
Installation
Add the library to your .NET project using NuGet:
dotnet add package devdeer.Libraries.Azure.BlobStorage
Documentation
The documentation is divided into several sections:
Authentication Methods
This module supports multiple ways to authenticate and interact with Azure Blob Storage. You can choose the method that best suits your deployment environment and security requirements. The supported methods are:
1. Connection String
- Description: Uses an explicit connection string which encapsulates all required authentication details.
- Usage: Supply a complete connection string directly in your configuration.
- Example:
{ "BlobStorageOptions": { "ConnectionString": "storage-account-connection-string" } }
2. Account Name + Account Key
- Description: Uses the storage account's name and key to create an authenticated client.
- Usage:
Provide both
AccountNameandAccountKeyin your configuration. The package will construct the connection string dynamically if an explicit connection string is not provided. - Example:
{ "BlobStorageOptions": { "AccountName": "storage-account-name", "AccountKey": "storage-account-key" } }
3. Default Azure Credential + Account Name
- Description:
Leverages the
DefaultAzureCredentialclass from the Azure Identity library for authentication. This method is ideal for environments where managed identities or developer credentials (e.g., Visual Studio, Azure CLI) are available. - Usage:
Provide the
AccountNamein your configuration. The module will use theDefaultAzureCredentialto automatically select the best available credential (e.g., environment variables, managed identity, Azure CLI credentials, etc.). - Example:
{ "BlobStorageOptions": { "AccountName": "storage-account-name" } } - Remarks:
- Ensure that your environment is configured with the necessary credentials (e.g., through environment variables or managed identity).
- Consider enabling Managed Identity on your Azure resources.
Injecting and Using the Blob Storage Logic
To register our service in Program.cs, add the following dependency
injection configuration:
var builder = Host.CreateDefaultBuilder(args)
.ConfigureServices((context, services) =>
{
// Register options from configuration
services.RegisterOption<BlobStorageOptions>(BlobStorageOptions.ConfigurationKey);
// Register blob storage logic
services.AddScoped<IBlobStorageLogic, BlobStorageLogic>();
});
After registering the service, you can inject it into your classes and use it as needed. The example below demonstrates
injecting IBlobStorageLogic into a service and using it to upload a file:
public class CustomService
{
// Field for the blob storage logic instance.
private readonly IBlobStorageLogic _blobStorageLogic;
// Constructor with dependency injection.
public CustomService(IBlobStorageLogic blobStorageLogic)
{
_blobStorageLogic = blobStorageLogic;
}
// Method with Azure blob storage service implementation.
public async Task CustomMethod(...)
{
//...
BlobClient? blobClient = null;
try
{
// Upload the file to Azure Blob Storage.
var blobClient = await _blobStorageLogic.UploadAsync(fileStream, blobName, containerName);
}
catch(Exception ex)
{
// Handle exceptions.
}
}
}
About DEVDEER
DEVDEER is a company from Magdeburg, Germany which is specialized in consulting, project management and development. We are very focussed on Microsoft Azure as a platform to run our products and solutions in the cloud. So all of our backend components usually runs in this environment and is developed using .NET. In the frontend area we are using react and a huge bunch of packages to build our UIs.
You can find us online:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Azure.Identity (>= 1.17.1)
- Azure.Storage.Blobs (>= 12.26.0)
- Azure.Storage.Blobs.Batch (>= 12.23.0)
- devdeer.Libraries.Abstractions (>= 20.0.0)
- devdeer.Libraries.Utilities (>= 4.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Options (>= 10.0.1)
-
net8.0
- Azure.Identity (>= 1.17.1)
- Azure.Storage.Blobs (>= 12.26.0)
- Azure.Storage.Blobs.Batch (>= 12.23.0)
- devdeer.Libraries.Abstractions (>= 20.0.0)
- devdeer.Libraries.Utilities (>= 4.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Options (>= 10.0.1)
-
net9.0
- Azure.Identity (>= 1.17.1)
- Azure.Storage.Blobs (>= 12.26.0)
- Azure.Storage.Blobs.Batch (>= 12.23.0)
- devdeer.Libraries.Abstractions (>= 20.0.0)
- devdeer.Libraries.Utilities (>= 4.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Options (>= 10.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.0 | 0 | 12/20/2025 |
| 0.6.0 | 101 | 12/13/2025 |
| 0.5.1 | 166 | 11/28/2025 |
| 0.5.0 | 438 | 11/20/2025 |
| 0.4.1 | 219 | 11/9/2025 |
| 0.4.0 | 199 | 11/9/2025 |
| 0.3.17-beta | 129 | 11/7/2025 |
| 0.3.16-beta | 207 | 10/21/2025 |
| 0.3.15-beta | 113 | 10/18/2025 |
| 0.3.14-beta | 163 | 10/15/2025 |
| 0.3.13-beta | 109 | 10/11/2025 |
| 0.3.12-beta | 110 | 10/11/2025 |
| 0.3.11-beta | 166 | 10/7/2025 |
| 0.3.10-beta | 167 | 10/7/2025 |
| 0.3.9-beta | 165 | 10/7/2025 |
| 0.3.8-beta | 168 | 10/6/2025 |
| 0.3.7-beta | 99 | 10/4/2025 |
| 0.3.6-beta | 113 | 9/27/2025 |
| 0.3.5-beta | 227 | 8/28/2025 |
| 0.3.4-beta | 186 | 8/13/2025 |
| 0.3.3-beta | 151 | 7/29/2025 |
| 0.3.1-beta | 154 | 7/29/2025 |
| 0.3.0-beta | 177 | 7/16/2025 |
| 0.2.5-beta | 185 | 7/14/2025 |
| 0.2.4-beta | 142 | 5/30/2025 |
| 0.2.3-beta | 233 | 5/16/2025 |
| 0.2.0-beta | 173 | 4/11/2025 |
| 0.1.5-beta | 198 | 4/3/2025 |
| 0.1.4-beta | 190 | 3/18/2025 |
| 0.1.3-beta | 183 | 3/18/2025 |
| 0.1.2-beta | 370 | 3/17/2025 |
| 0.1.1-beta | 325 | 2/14/2025 |
- BREAKING CHANGES:
- OperationResultModel is removed.
- Uploading now returns `BlobClient` instance.
- `CountBlobs` method is renamed to `GetBlobAmountAsync` and returns `int`.
- `GetContainerStatistics` method returns `ContainerStatisticsModel`.
- `DownloadToStreamAsync` now returns ready-to-read `Stream` with Position set to 0.
- `DownloadToPathAsync` now returns string with full path to the downloaded file.
- Renamed `DeleteIfExistsAsync` to `DeleteBlobIfExistsAsync` and changed return type to `ValueTask<bool>`
- Updated `DeleteContainerAsync` to return `Task`
- Added in logic:
- Copying of a blob within one or different containers (with metadata if needed)
- Moving of a blob within one or different containers (with metadata if needed)
- Getting properties of: Blob, Container, Blob Service
- Asynchronous iteration through blobs (FetchBlobsAsync)
- Batched deletion support. Automatic batches packing if blobs amount is greater than 256
- Deletion of all blobs in a container
- Deletion of a container
- Support for `null` or empty string as `prefix` argument in `CountBlobsAsync()` and `GetContainerStatisticsAsync()`,
which results in the same result as their simpler overloaded versions
- Support for optional cancellation token in upload methods
- In `DownloadToStreamAsync` optional `targetFileName` parameter
-Added in BlobStorageHelper:
- Getting URI of blob and container
-Added in MetadataHelper:
- Method which throws an exception with details if metadata is invalid
-Added `BlobClient` extension method:
- GetMetadataAsync for retrieving metadata of a blob as a dictionary
- Bug fixes:
- Fixed bug in DownloadToPathAsync, where the full blobs path was used as the file name
- While uploading a blob, failed metadata or HTTP headers setting won't cause a failed operation. URI of the blob will be returned.
- Package updates.