0

I was trying to add HealthChecks for AzureKeyVault to my project and added following nuget package for that :

<PackageReference Include="AspNetCore.HealthChecks.AzureKeyVault" Version="6.0.2" />

And in code, added following :

var url = "https://123456.com";
    builder.Services
        .AddHealthChecks()
        .AddAzureKeyVault(new Uri(url), keyVaultCredential,
                         options => { }, "AKV", HealthStatus.Unhealthy,
                         tags: new string[] { "azure", "keyvault", "key-vault", "azure-keyvault" });

But issue is, its showing healthy for each and every URL, just it should be proper URL. and even in keyVaultCredential, if some random values are added, it showing status healthy.

Do some one know, how can use this HealthCheck

Sukhi
  • 45
  • 1
  • 7

2 Answers2

2

I have the same problem, I found we need to add at lease one key vault secret in the opts to make it work. e.g. options => { options.AddSecret("SQLServerConnection--connectionString");}

1
  • Please check if there are any restrictions in knowing the health status of azure resources or with the use of this library in your company VPN network .
  • Try the same in different network to check if the cause is network issue or VPN
  • Try with debugging tools to capture the traffic to verify and see response.

References:

  1. AzureKeyVault health check always returns "healthy" (github.com)
  2. AspNetCore.Diagnostics.HealthChecks
kavyaS
  • 8,026
  • 1
  • 7
  • 19
  • Tried all the options but still the same error, it shouldn't display "healthy" when URL/credentials are not right :( – Sukhi Jun 08 '22 at 05:35