DuckTyping.Azure.BlobService 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package DuckTyping.Azure.BlobService --version 1.0.3
                    
NuGet\Install-Package DuckTyping.Azure.BlobService -Version 1.0.3
                    
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="DuckTyping.Azure.BlobService" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DuckTyping.Azure.BlobService" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="DuckTyping.Azure.BlobService" />
                    
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 DuckTyping.Azure.BlobService --version 1.0.3
                    
#r "nuget: DuckTyping.Azure.BlobService, 1.0.3"
                    
#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 DuckTyping.Azure.BlobService@1.0.3
                    
#: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=DuckTyping.Azure.BlobService&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=DuckTyping.Azure.BlobService&version=1.0.3
                    
Install as a Cake Tool

DuckTyping.Azure.BlobService

A service that lets you connect to the azure blob service.

Configuration

Add the Blob storage:

  • AccountName
  • URL (e.g. https://<your-account-name>.blob.core.windows.net)
  • Access key

In the configuration section of Program.cs add the following lines:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddBlobClient(options =>
{
    options.AccountName = Environment.GetEnvironmentVariable("BLOB_STORAGE_ACCOUNTNAME");
    options.Url = Environment.GetEnvironmentVariable("BLOB_STORAGE_URL");
    options.Key = Environment.GetEnvironmentVariable("BLOB_STORAGE_KEY");
});

var app = builder.Build();

Or if you prefer to use the appsettings.json Configurations

{
  "BlobStorage": {
    "AccountName": "your-account-name",
    "Url": "https://your-account-name.blob.core.windows.net",
    "Key": "your-access-key"
  }
}
var builder = WebApplication.CreateBuilder(args);

builder.Services.AddBlobClient(options =>
{
    options.AccountName = builder.Configuration["BlobStorage:AccountName"]!;
    options.Url = builder.Configuration["BlobStorage:Url"]!;
    options.Key = builder.Configuration["BlobStorage:Key"]!;
});

var app = builder.Build();

User the client

To use the client, import the namespace ducktyping.azure.blobservice;

using DuckTyping.Azure.BlobService;

public class MyService(IBlobClient blobClient)
{
    private readonly IBlobClient _blobClient = blobClient;

    public async Task UploadFileAsync()
    {
        await _blobClient.UploadAsync(
            containerName: "my-container",
            fileName: "example.pdf",
            contentType: "application/pdf",
            stream: File.OpenRead("example.pdf")
        );
    }
}
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.  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. 
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.1.0 157 7/6/2025
1.0.3 78 7/4/2025
1.0.2 79 7/4/2025