0
votes

I have seen that SAS can be generated using Storage API.
Is there a way to generate it from Management Studio or with out using API?

2

2 Answers

0
votes

You could create a SAS using REST API. In fact, storage client library is just a wrapper over this REST API. Here's the link for creating SAS using REST API: http://msdn.microsoft.com/en-us/library/windowsazure/dn140255.aspx.

0
votes

This document describes how the SAS should be generated. You can use the API/SDK or you can write your own code for it.

The string-to-sign is a unique string constructed from the fields that must be verified in order to authenticate the request. The signature is an HMAC computed over the string-to-sign and key using the SHA256 algorithm, and then encoded using Base64 encoding.

For example in the latest version you make the string to sign like this:

StringToSign = signedpermissions + "\n" +
               signedstart + "\n" +
               signedexpiry + "\n" +
               canonicalizedresource + "\n" +
               signedidentifier + "\n" +
               signedIP + "\n" +
               signedProtocol + "\n" +
               signedversion + "\n" +
               rscc + "\n" +
               rscd + "\n" +
               rsce + "\n" +
               rscl + "\n" +
               rsct

and then you'd compute the hash of that and encode.

You're much better off using the SDK if possible, else grabbing some existing code that does it instead of writing from scratch. e.g. see this question or this, or maybe the SDK code is available so you can just inspect that and take the bits you like.