HealthChecks.Azure.KeyVault.Secrets is the health check package for Azure Key Vault secrets
Get Started
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard |
README
Azure KeyVault Secrets Health Check
This health check verifies the ability to communicate with Azure Key Vault Secrets. It uses the provided SecretClient to get configured secret. When the connection to the service itself can be made, but secret is not found, it returns HealthStatus.Healthy status.
Defaults
By default, the SecretClient instance is resolved from service provider. AzureKeyVaultSecretsHealthCheckOptions by default uses "AzureKeyVaultSecretsHealthCheck" secret name and does not try to create the secret when it's not found.
void Configure(IHealthChecksBuilder builder)
{
builder.Services.AddSingleton(sp => new SecretClient(new Uri("azure-key-vault-uri"), new DefaultAzureCredential()));
builder.AddHealthChecks().AddAzureKeyVaultSecrets();
}
Customization
You can additionally add the following parameters:
clientFactory: A factory method to provideSecretClientinstance.optionsFactory: A factory method to provideAzureKeyVaultSecretsHealthCheckOptionsinstance. It allows to specify the secret name and whether the secret should be created when it's not found.name: The health check name. The default isazure_key_vault_secret.failureStatus: TheHealthStatusthat should be reported when the health check fails. Default isHealthStatus.Unhealthy.tags: A list of tags that can be used to filter sets of health checks.timeout: ASystem.TimeSpanrepresenting the timeout of the check.
void Configure(IHealthChecksBuilder builder)
{
builder.Services.AddSingleton(sp => new SecretClient(new Uri("azure-key-vault-uri"), new DefaultAzureCredential()));
builder.AddHealthChecks().AddAzureKeyVaultSecrets(
optionsFactory: sp => new AzureKeyVaultSecretsHealthCheckOptions()
{
SecretName = "demo"
});
}
Performance
When the secret is not found, the secret client throws RequestFailedException. The health check catches it, but it's expensive in terms of performance.
That is why it's recommended to create the secret before using the health check. It can be done by using AzureKeyVaultSecretsHealthCheckOptions.CreateWhenNotFound, but it requires secret set permissions. Such permissions should not be assigned just for the purpose of using this health check!
For more information about credentials types please see Azure TokenCredentials
Downloads by Version
Similar & Alternative Packages
Hand-picked matching NuGet libraries based on tags & ecosystem
Depended On By
Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.