Skip to content

Commit b28f3b2

Browse files
committed
fix: update BlobServiceClient initialization to use DefaultAzureCredentialOptions
1 parent 673b555 commit b28f3b2

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Web/Program.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@
145145
if (Uri.IsWellFormedUriString(connectionString, UriKind.Absolute))
146146
{
147147
// If the connection string is a URI, use it directly
148-
return new BlobServiceClient(new Uri(connectionString), new DefaultAzureCredential());
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+
149156
}
150157
else
151158
{
@@ -204,10 +211,10 @@
204211
// Set headers to ensure proper cache behavior for bundled files
205212
context.Response.OnStarting(() =>
206213
{
207-
context.Response.Headers.CacheControl = "public,max-age=31536000,immutable";
208-
context.Response.Headers.Vary = "Accept-Encoding";
209-
return Task.CompletedTask;
210-
});
214+
context.Response.Headers.CacheControl = "public,max-age=31536000,immutable";
215+
context.Response.Headers.Vary = "Accept-Encoding";
216+
return Task.CompletedTask;
217+
});
211218
}
212219
await next();
213220
});

0 commit comments

Comments
 (0)