As @Pratik Pathak mentioned, one way is to use the actual Azure storage URL, which has worked for me in the past, but you could also use blobServiceClient
instead of bobClient
.
string connectionString = _configuration.GetConnectionString("AzureStorage");
string containerName = "container-name";
var blobServiceClient = new BlobServiceClient(connectionString);
var containerClient = blobServiceClient.GetBlobContainerClient(containerName);
var blobClient = containerClient.GetBlobClient(filePath);
var blobDownloadInfo = await blobClient.DownloadAsync();
var contentType = blobDownloadInfo.Value.Details.ContentType ?? "application/octet-stream";
return File(blobDownloadInfo.Value.Content, contentType, Path.GetFileName(filePath));