Created
September 13, 2013 03:06
-
-
Save chechedotmx/6546396 to your computer and use it in GitHub Desktop.
This codes retreives an existing blob with permissions to read, Azure Blob, C# Then for example we get this data to a byte array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String GetBlobUriWithSAS(String containerName, String blobName) | |
{ | |
CloudBlobContainer container = this._blobClient.GetContainerReference(containerName); | |
container.CreateIfNotExists(); | |
CloudBlockBlob blockBlob = container.GetBlockBlobReference(blobName); | |
String sharedAccesSignature = blockBlob.GetSharedAccessSignature(new SharedAccessBlobPolicy() | |
{ | |
Permissions = SharedAccessBlobPermissions.Read, | |
SharedAccessExpiryTime = DateTime.UtcNow + TimeSpan.FromMinutes(10) | |
}); | |
return blockBlob.Uri.AbsoluteUri + sharedAccesSignature; | |
} | |
//Getting this on a bytearray | |
var webClient = new WebClient(); | |
byte[] byteArrayToRetreive = webClient.DownloadData(UriWithSAS); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment