Can I create a SAS url to access all files and folders of a directory in Azure File share (i.e. not Blobs) in C#?

Viewed 1827

How can I get a Sas url with read-only or write-only permission for a directory in Azure File Share to access all files and sub directory in that directory but it will not be accessible by other directory o files in Azure File Share?

Is there any way to create the sasToken by using the REST API or client libraries for a Directory in c#? In Microsoft Document (https://docs.microsoft.com/en-us/azure/storage/files/storage-files-faq) they said it's possible to create a shared access signature by using the REST API or client libraries, by specifying read-only or write-only permissions on folders within the share.

Any Suggestion how this works?

2 Answers

How can I get a Sas url with read-only or write-only permission for a directory in Azure File Share to access all files and sub directory in that directory but it will not be accessible by other directory o files in Azure File Share?

It is not possible to create a SAS token to restrict access to a directory only. You can either create a SAS token for an entire share or a file but not for a directory.

Directory scoped SAS is now supported for file shares and blobs, see this for more details.

Related