Different Filename for file kept in Azure Blob storage container

45 Views Asked by At

We create a SAS token for a single blob file and share the URL with the user. Users can click the link and download the blob file directly from the Azure storage container. Assume the blob file is stored as abc.txt but while downloading it should be downloaded as xyz.txt.

Our Azure Storage is version-enabled.

1

There are 1 best solutions below

0
Skip Saillors On

If you have .NET then you have the Azure Blob libraries, I expect. In Azure.Storage.Blobs v12.19.1 there is BlobBaseClient.DownloadToAsync(...)

https://learn.microsoft.com/en-us/dotnet/api/azure.storage.blobs.specialized.blobbaseclient.downloadtoasync?view=azure-dotnet

await client.DownloadToAsync("xyz.txt");

Creating the BlobBaseClient and connecting it to the storage account, and dealing with the logistics of writing a file on a local computer is a whole set of other questions.