Share via


AspireBlobStorageExtensions.AddKeyedAzureBlobClient Method

Definition

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

public static void AddKeyedAzureBlobClient (this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.Azure.Storage.Blobs.AzureStorageBlobsSettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Storage.Blobs.BlobServiceClient,Azure.Storage.Blobs.BlobClientOptions>>? configureClientBuilder = default);
static member AddKeyedAzureBlobClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.Storage.Blobs.AzureStorageBlobsSettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Storage.Blobs.BlobServiceClient, Azure.Storage.Blobs.BlobClientOptions>> -> unit
<Extension()>
Public Sub AddKeyedAzureBlobClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of AzureStorageBlobsSettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of BlobServiceClient, BlobClientOptions)) = Nothing)

Parameters

builder
IHostApplicationBuilder

The IHostApplicationBuilder to read config from and add services to.

name
String

The name of the component, which is used as the ServiceKey of the service and also 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:{name}" section.

Applies to