Home > Software design >  Use SAS to perform basic Azure BLOB storage functions
Use SAS to perform basic Azure BLOB storage functions

Time:06-06

I am trying to build a Web API with .Net Core to work with Azure BLOB storage which has the standard Upload, download, and delete functionality. Upload is standard file upload using IFormFile where the user chooses a file from local computer and hits the upload button. Download follows the same and Delete is delete.

Followed the examples from Azure-Samples Git repos using the connection string, BlobContainerClient, and BlobClient and they all work without any issue.

Now the admins here have asked to use the SAS instead of the connection string. I got some help getting started here

Can someone please point to samples from which I can learn this part too.

Thanks in advance.

CodePudding user response:

There is a constructor of BlobContainerClient that takes an AzureSasCredential. It has the following signature:

public BlobContainerClient (Uri blobContainerUri, Azure.AzureSasCredential credential, Azure.Storage.Blobs.BlobClientOptions options = default);

You should be able to construct the AzureSasCredential from the SAS string.

  • Related