Skip to content

Commit a79fcfa

Browse files
committed
Enable health checks on blobs resource.
1 parent d8db54e commit a79fcfa

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Aspire.Hosting.Azure.Storage/AzureStorageExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
using Azure.Identity;
99
using Azure.Provisioning;
1010
using Azure.Provisioning.Storage;
11-
using Azure.ResourceManager.Storage.Models;
1211
using Azure.Storage.Blobs;
12+
using Microsoft.Extensions.DependencyInjection;
1313
//using Microsoft.Extensions.DependencyInjection;
1414

1515
namespace Aspire.Hosting;
@@ -214,14 +214,14 @@ public static IResourceBuilder<AzureBlobStorageResource> AddBlobs(this IResource
214214
blobServiceClient = CreateBlobServiceClient(connectionString);
215215
});
216216

217-
//var healthCheckKey = $"{name}_blob_check";
218-
//builder.ApplicationBuilder.Services.AddHealthChecks().AddAzureBlobStorage(sp =>
219-
//{
220-
// return blobServiceClient ?? throw new InvalidOperationException("BlobServiceClient is not initialized.");
221-
//}, name: healthCheckKey);
217+
var healthCheckKey = $"{name}_blob_check";
218+
builder.ApplicationBuilder.Services.AddHealthChecks().AddAzureBlobStorage(sp =>
219+
{
220+
return blobServiceClient ?? throw new InvalidOperationException("BlobServiceClient is not initialized.");
221+
}, name: healthCheckKey);
222222

223-
return builder.ApplicationBuilder.AddResource(resource);
224-
// .WithHealthCheck(healthCheckKey);
223+
return builder.ApplicationBuilder.AddResource(resource)
224+
.WithHealthCheck(healthCheckKey);
225225

226226
static BlobServiceClient CreateBlobServiceClient(string connectionString)
227227
{

0 commit comments

Comments
 (0)