AspireBlobStorageExtensions.AddAzureBlobClient Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Registers BlobServiceClient as a singleton in the services provided by the builder
.
Enables retries, corresponding health check, logging and telemetry.
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);
static member AddAzureBlobClient : 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 AddAzureBlobClient (builder As IHostApplicationBuilder, connectionName 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.
- 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.