title: Is there an easy way to health-check an Azure blob storage with multiple keys?
body: <p>I am building an Azure web service using ASP.NET Core (C#, .NET 6). I have an Azure storage account. The storage account has two (2) access keys. The idea is that if the first key expires or needs to be changed, the application can seemlessly switch to the second key while operators renew the first key.</p>
  <p>My application has a health check, and I would like to include a health check of the storage account. I took inspiration from this article: <a href="https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/monitor-app-health#healthchecks-implementation-in-eshoponcontainers" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/monitor-app-health#healthchecks-implementation-in-eshoponcontainers</a></p>
  <p>I wrote code like this, using NuGet package <strong>AspNetCore.HealthChecks.AzureStorage</strong>:</p>
  <pre><code>services.AddHealthChecks()
      .AddAzureBlobStorage(
          $&quot;DefaultEndpointsProtocol=https;AccountName={accountName};AccountKey={key1};EndpointSuffix=core.windows.net&quot;,
          name: &quot;catalog-storage-check&quot;,
          tags: new string[] { &quot;catalogstorage&quot; });
  </code></pre>
  <p>The problem is that this health check will fail if key 1 is expired or revoked. That is not what I want. I want the health check to succeed as long as <em>at least 1 of the 2 keys</em> works, and fail if <em>both keys fail</em>.</p>
  <p>Is there an easy way to do this, or will I have to code it on my own?</p>