AspireKeyVaultExtensions.AddKeyedAzureKeyVaultClient Method
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 SecretClient as a singleton for given name
in the services provided by the builder
.
Enables retries, corresponding health check, logging and telemetry.
public static void AddKeyedAzureKeyVaultClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.Azure.Security.KeyVault.AzureSecurityKeyVaultSettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Security.KeyVault.Secrets.SecretClient,Azure.Security.KeyVault.Secrets.SecretClientOptions>>? configureClientBuilder = default);
static member AddKeyedAzureKeyVaultClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.Security.KeyVault.AzureSecurityKeyVaultSettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.Security.KeyVault.Secrets.SecretClient, Azure.Security.KeyVault.Secrets.SecretClientOptions>> -> unit
<Extension()>
Public Sub AddKeyedAzureKeyVaultClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of AzureSecurityKeyVaultSettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of SecretClient, SecretClientOptions)) = Nothing)
- 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 information from the ConnectionStrings configuration section.
- configureSettings
- Action<AzureSecurityKeyVaultSettings>
An optional method that can be used for customizing the AzureSecurityKeyVaultSettings. It's invoked after the settings are read from the configuration.
- configureClientBuilder
- Action<IAzureClientBuilder<SecretClient,SecretClientOptions>>
An optional method that can be used for customizing the IAzureClientBuilder<TClient,TOptions>.
Thrown when mandatory VaultUri is not provided.
Reads the configuration from "Aspire:Azure:Security:KeyVault:{name}" section.
Product | Versions |
---|---|
.NET Aspire | 8.0.0, 9.0.0, 9.1.0 |