Vali-Blob.Azure 1.0.0

dotnet add package Vali-Blob.Azure --version 1.0.0
                    
NuGet\Install-Package Vali-Blob.Azure -Version 1.0.0
                    
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="Vali-Blob.Azure" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vali-Blob.Azure" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Vali-Blob.Azure" />
                    
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 Vali-Blob.Azure --version 1.0.0
                    
#r "nuget: Vali-Blob.Azure, 1.0.0"
                    
#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.
#:package Vali-Blob.Azure@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Vali-Blob.Azure&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Vali-Blob.Azure&version=1.0.0
                    
Install as a Cake Tool

Vali-Blob.Azure

NuGet License: MIT .NET

Azure Blob Storage provider for Vali-Blob — the unified cloud storage abstraction library for .NET.

Implements IStorageProvider over Azure Blob Storage with SAS token presigned URLs, resumable block-blob uploads, optional automatic container creation, and seamless DI registration.


Compatibility

Target Framework Supported
netstandard2.0 Yes
netstandard2.1 Yes
net6.0 Yes
net7.0 Yes
net8.0 Yes
net9.0 Yes

Installation

dotnet add package ValiBlob.Core
dotnet add package ValiBlob.Azure

Configuration

Using a connection string

{
  "ValiBlob": {
    "DefaultProvider": "Azure"
  },
  "ValiBlob:Azure": {
    "Container":                  "my-files",
    "ConnectionString":           "DefaultEndpointsProtocol=https;AccountName=...;AccountKey=...;EndpointSuffix=core.windows.net",
    "CreateContainerIfNotExists": true
  }
}

Using account name + key

{
  "ValiBlob:Azure": {
    "Container":   "my-files",
    "AccountName": "mystorageaccount",
    "AccountKey":  ""
  }
}

Security: Never commit AccountKey or ConnectionString to source control. Use Azure Key Vault, environment variables, or Managed Identity instead.

{
  "ValiBlob:Azure": {
    "Container":   "my-files",
    "AccountName": "mystorageaccount"
  }
}

When AccountKey is absent and no ConnectionString is set, the provider uses DefaultAzureCredential — which automatically picks up Managed Identity on App Service, AKS, and Azure VMs.


Registration

using ValiBlob.Core.DependencyInjection;
using ValiBlob.Azure.Extensions;

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "Azure")
    .UseAzure();

With pipeline

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "Azure")
    .UseAzure()
    .WithPipeline(p => p
        .UseValidation(v =>
        {
            v.AllowedExtensions = new[] { ".jpg", ".png", ".pdf", ".docx" };
            v.MaxFileSizeBytes  = 100 * 1024 * 1024; // 100 MB
        })
        .UseEncryption(e =>
        {
            e.Key = Convert.FromBase64String(builder.Configuration["Storage:Key"]!);
        })
    );

Usage

Upload

public class FileService(IStorageProvider storage)
{
    public async Task<string> UploadAsync(IFormFile file)
    {
        await using var stream = file.OpenReadStream();

        var result = await storage.UploadAsync(new UploadRequest
        {
            Path        = StoragePath.From("uploads", file.FileName),
            Content     = stream,
            ContentType = file.ContentType
        });

        if (!result.IsSuccess)
            throw new Exception(result.ErrorMessage);

        return result.Value!.Url;
    }
}

Download

var result = await storage.DownloadAsync(new DownloadRequest
{
    Path = StoragePath.From("uploads", "photo.jpg")
});

if (result.IsSuccess)
{
    using var stream = result.Value!;
    await stream.CopyToAsync(Response.Body);
}

Generate SAS presigned URL

// Download URL — valid for 30 minutes
var download = await storage.GetPresignedDownloadUrlAsync(new PresignedUrlRequest
{
    Path      = StoragePath.From("invoices", "invoice-001.pdf"),
    ExpiresIn = TimeSpan.FromMinutes(30)
});

// Upload URL — client uploads directly to Azure
var upload = await storage.GetPresignedUploadUrlAsync(new PresignedUrlRequest
{
    Path      = StoragePath.From("uploads", "video.mp4"),
    ExpiresIn = TimeSpan.FromMinutes(15)
});

Resumable upload

var session = await resumable.StartUploadAsync(new ResumableUploadRequest
{
    FileName    = "backup.zip",
    ContentType = "application/zip",
    TotalSize   = totalBytes
});

// Upload chunks sequentially or with retry
foreach (var (chunk, index) in chunks.Select((c, i) => (c, i)))
{
    await resumable.UploadChunkAsync(new ResumableChunkRequest
    {
        SessionId  = session.SessionId,
        ChunkIndex = index,
        Data       = chunk
    });
}

await resumable.CompleteUploadAsync(session.SessionId);

Features

Feature Supported
Upload / Download / Delete / List Yes
Exists check Yes
Copy / Move Yes
Presigned upload URL (SAS) Yes
Presigned download URL (SAS) Yes
Resumable chunked uploads Yes
BucketOverride per request Yes
Automatic container creation Yes (opt-in)
Managed Identity Yes
Custom metadata Yes
Polly retry resilience Yes

Options reference

Property Default Description
Container — Blob container name (required)
ConnectionString — Full Azure Storage connection string
AccountName — Storage account name (used with AccountKey or Managed Identity)
AccountKey — Storage account key
CreateContainerIfNotExists false Auto-create the container on startup
SasTokenExpiryMinutes 60 Default expiry for generated SAS tokens

Documentation



Donations

If Vali-Blob is useful to you, consider supporting its development:


License

MIT License

Contributions

Issues and pull requests are welcome on GitHub.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.0 261 3/21/2026