Open
Description
Library name and version
Microsoft.Extensions.Azure 1.11.0
Describe the bug
Within the BlobClientBuilderExtensions
the method
public static IAzureClientBuilder<BlobServiceClient, BlobClientOptions> AddBlobServiceClient<TBuilder>(this TBuilder builder, Uri serviceUri, TokenCredential tokenCredential)
where TBuilder : IAzureClientFactoryBuilderWithCredential
{
return builder.RegisterClientFactory<BlobServiceClient, BlobClientOptions>((options, token) => new BlobServiceClient(serviceUri, token, options));
}
is not passing down the provided TokenCredential
.
Expected behavior
The provided TokenCredential
will be used, maybe like this:
public static IAzureClientBuilder<BlobServiceClient, BlobClientOptions> AddBlobServiceClient<TBuilder>(this TBuilder builder, Uri serviceUri, TokenCredential tokenCredential)
where TBuilder : IAzureClientFactoryBuilderWithCredential
{
return builder.RegisterClientFactory<BlobServiceClient, BlobClientOptions>((options, _) => new BlobServiceClient(serviceUri, tokenCredential, options));
}
Actual behavior
The DefaultAzureCredential
is always being used, which leads to unnecessary token requests, that mostly cannot be resolved and even throw exceptions when some configuration is missing.
Reproduction Steps
Add the service to the IServiceCollection
like this:
services.AddAzureClients(
config =>
{
config.AddBlobServiceClient(
new Uri("<url to the storage account>"),
new AzureCliCredential());
});
Environment
No response
Metadata
Metadata
Assignees
Labels
This issue points to a problem in the data-plane of the library.Workflow: This issue is responsible by Azure service team.Storage Service (Queues, Blobs, Files)Issues that are reported by GitHub users external to the Azure organization.Workflow: The Azure SDK team believes it to be addressed and ready to close.The issue doesn't require a change to the product in order to be resolved. Most issues start as that