devdeer.Libraries.Azure.BlobStorage 0.2.0-beta

This is a prerelease version of devdeer.Libraries.Azure.BlobStorage.
dotnet add package devdeer.Libraries.Azure.BlobStorage --version 0.2.0-beta
                    
NuGet\Install-Package devdeer.Libraries.Azure.BlobStorage -Version 0.2.0-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="devdeer.Libraries.Azure.BlobStorage" Version="0.2.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="devdeer.Libraries.Azure.BlobStorage" Version="0.2.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="devdeer.Libraries.Azure.BlobStorage" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add devdeer.Libraries.Azure.BlobStorage --version 0.2.0-beta
                    
#r "nuget: devdeer.Libraries.Azure.BlobStorage, 0.2.0-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=devdeer.Libraries.Azure.BlobStorage&version=0.2.0-beta&prerelease
                    
Install devdeer.Libraries.Azure.BlobStorage as a Cake Addin
#tool nuget:?package=devdeer.Libraries.Azure.BlobStorage&version=0.2.0-beta&prerelease
                    
Install devdeer.Libraries.Azure.BlobStorage as a Cake Tool

devdeer.Libraries.Azure.BlobStorage • NuGet Downloads


A lightweight wrapper for the official Azure Blob Storage API.

  • Automatic Authorization: Provides multiple ways for automatic authorization.

  • Simplified Methods: Provides easy-to-use functions for common Blob Storage operations.

  • Built-in Exception Handling: Ensures all methods return a custom OperationResultModel<T>, encapsulating either the request result or error details.

  • Logging Integration: Supports .NET’s built-in logging framework.

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.
  • Asynchronous support using Task-based methods.
  • Responses are encapsulated in a custom response model.
  • 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 AccountName and AccountKey in 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 DefaultAzureCredential class 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 AccountName in your configuration. The module will use the DefaultAzureCredential to 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.

Handling Operation Results

This package provides a standardized way to handle operation results when interacting with Blob Storage. All methods return an instance of OperationResultModel<T>, which encapsulates success status, the operation result, and error messages.

Injecting and Using the Blob Storage Service

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.AddTransient<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(...)
    {
        ...
        var operation = await _blobStorageLogic.UploadAsync(fileStream, blobName, containerName);
        if (operation.Success){
            Console.WriteLine($"Upload successful! Blob is stored at {operation.Result}");
        }
        else{
            Console.WriteLine($"Something went wrong. {operation.ErrorMessage}");
        }
    }
}

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:

Website

GitHub GitHub Org's stars

YouTube YouTube Channel Subscribers YouTube Channel Views

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0-beta 91 4/11/2025
0.1.5-beta 119 4/3/2025
0.1.4-beta 117 3/18/2025
0.1.3-beta 115 3/18/2025
0.1.2-beta 279 3/17/2025
0.1.1-beta 226 2/14/2025

- Nuget updates