Answered by:
MS Tech Talk: "How do I use a Shared Access Signature (SAS) in managed code to access Azure Storage?"

Question
-
Is it possible to use managed code to download and list blobs in a storage account using only SAS as authorization, or is SAS’s utility limited to the REST API?
MS Tech Talk personaMonday, October 25, 2010 6:08 PM
Answers
-
There is only one API to Windows Azure storage, and it is REST. The .NET StorageClient library is a wrapper around the REST API and yes, it supports Shared Access Signatures.
For instruction on how to create and implement a SAS via the .NET StorageClient library, see Steve Marx’s blog post: http://blog.smarx.com/posts/shared-access-signatures-are-easy-these-days
Read the whole blog, but the following text contains the most relevant information:
// now just use the SAS to do blob operations var sasCreds = new StorageCredentialsSharedAccessSignature(sas); // new client using the same endpoint (including account name), // but using the SAS as the credentials var sasBlob = new CloudBlobClient(account.BlobEndpoint, sasCreds) .GetBlobReference("testcontainer/test.txt"); sasBlob.UploadText("Hello again!"); Console.WriteLine(sasBlob.DownloadText());
MS Tech Talk persona- Marked as answer by MS Tech Talk Monday, October 25, 2010 6:09 PM
Monday, October 25, 2010 6:09 PM -
I did a blog post on Access Control for Azure Blobs that goes into shared-access signatures in gory detail.
- Marked as answer by Brian AurichMicrosoft employee Tuesday, October 26, 2010 4:29 AM
Monday, October 25, 2010 6:31 PMAnswerer
All replies
-
There is only one API to Windows Azure storage, and it is REST. The .NET StorageClient library is a wrapper around the REST API and yes, it supports Shared Access Signatures.
For instruction on how to create and implement a SAS via the .NET StorageClient library, see Steve Marx’s blog post: http://blog.smarx.com/posts/shared-access-signatures-are-easy-these-days
Read the whole blog, but the following text contains the most relevant information:
// now just use the SAS to do blob operations var sasCreds = new StorageCredentialsSharedAccessSignature(sas); // new client using the same endpoint (including account name), // but using the SAS as the credentials var sasBlob = new CloudBlobClient(account.BlobEndpoint, sasCreds) .GetBlobReference("testcontainer/test.txt"); sasBlob.UploadText("Hello again!"); Console.WriteLine(sasBlob.DownloadText());
MS Tech Talk persona- Marked as answer by MS Tech Talk Monday, October 25, 2010 6:09 PM
Monday, October 25, 2010 6:09 PM -
I did a blog post on Access Control for Azure Blobs that goes into shared-access signatures in gory detail.
- Marked as answer by Brian AurichMicrosoft employee Tuesday, October 26, 2010 4:29 AM
Monday, October 25, 2010 6:31 PMAnswerer