Skip to content

Commit 8262b7d

Browse files
committed
fix: update Azure Blob Storage package reference to Aspire.Azure.Storage.Blobs
1 parent b28f3b2 commit 8262b7d

File tree

2 files changed

+3
-28
lines changed

2 files changed

+3
-28
lines changed

Web/Program.cs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.AspNetCore.Rewrite;
99
using Azure.Storage.Blobs;
1010
using Azure.Identity;
11+
using Microsoft.Extensions.Azure;
1112

1213
var builder = WebApplication.CreateBuilder(args);
1314

@@ -26,6 +27,7 @@
2627
});
2728

2829
builder.AddAzureTableClient("tables");
30+
builder.AddAzureBlobClient("blobs");
2931

3032
// Add Redis distributed caching - manual configuration since extension doesn't exist
3133

@@ -138,33 +140,6 @@
138140
options.Level = CompressionLevel.Optimal;
139141
});
140142

141-
// Add Azure Blob Storage
142-
builder.Services.AddSingleton(x =>
143-
{
144-
var connectionString = builder.Configuration.GetConnectionString("blobs");
145-
if (Uri.IsWellFormedUriString(connectionString, UriKind.Absolute))
146-
{
147-
// If the connection string is a URI, use it directly
148-
var options = new DefaultAzureCredentialOptions
149-
{
150-
ManagedIdentityClientId = builder.Configuration["AZURE_CLIENT_ID"]
151-
};
152-
153-
var credential = new DefaultAzureCredential(options);
154-
return new BlobServiceClient(new Uri(connectionString), credential);
155-
156-
}
157-
else
158-
{
159-
// Otherwise, treat it as a standard connection string
160-
if (string.IsNullOrWhiteSpace(connectionString))
161-
{
162-
throw new ArgumentException("Invalid Azure Blob Storage connection string.", nameof(connectionString));
163-
}
164-
return new BlobServiceClient(connectionString);
165-
}
166-
});
167-
168143
// Add Content Service with image handling
169144
builder.Services.AddSingleton<IContentService, ContentService>();
170145

Web/Web.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup> <ItemGroup>
88
<PackageReference Include="Aspire.Azure.Data.Tables" Version="9.3.0" />
9-
<PackageReference Include="Azure.Storage.Blobs" Version="12.24.1" />
9+
<PackageReference Include="Aspire.Azure.Storage.Blobs" Version="9.3.0" />
1010
<PackageReference Include="Aspire.StackExchange.Redis.DistributedCaching" Version="9.3.1" />
1111
<PackageReference Include="Aspire.StackExchange.Redis.OutputCaching" Version="9.3.1" />
1212
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.0.0" />

0 commit comments

Comments
 (0)