AspireBlobStorageExtensions.AddAzureBlobClient Method

Definition

Registers BlobServiceClient as a singleton in the services provided by the builder. Enables retries, corresponding health check, logging and telemetry.

C#
public static void AddAzureBlobClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string connectionName, Action<Aspire.Azure.Storage.Blobs.AzureStorageBlobsSettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Storage.Blobs.BlobServiceClient,Azure.Storage.Blobs.BlobClientOptions>>? configureClientBuilder = default);

Parameters

builder
IHostApplicationBuilder

The IHostApplicationBuilder to read config from and add services to.

connectionName
String

A name used to retrieve the connection string from the ConnectionStrings configuration section.

configureSettings
Action<AzureStorageBlobsSettings>

An optional method that can be used for customizing the AzureStorageBlobsSettings. It's invoked after the settings are read from the configuration.

configureClientBuilder
Action<IAzureClientBuilder<BlobServiceClient,BlobClientOptions>>

An optional method that can be used for customizing the IAzureClientBuilder<TClient,TOptions>.

Exceptions

Thrown when neither ConnectionString nor ServiceUri is provided.

Remarks

Reads the configuration from "Aspire:Azure:Storage:Blobs" section.

Applies to

Product Versions
.NET Aspire 8.0.0, 9.0.0, 9.1.0