Search code examples
azure-storageazure-filesazure-storage-filesazure-sas

Azure File Storage, using SAS


I am confused about using Azure File Storage and SAS. I thought the point of a SAS was to be able to have access to a resource without needing the account key.

I am looking to do a simple file upload, and when looking into this method, there are examples provided but the first thing they all do is create a CloudStorageAccount by .Parse on the connection string, which is the account key.

Can anyone point to a sample project or sample code which uploads a file to an Azure File Storage account, but doesn't use the account Key?


Solution

  • You can use below code to construct a CloudFile object:

    var cloudFile = new CloudFile(new Uri(fileUri), new StorageCredentials(sasToken));