title: How to call Azure Blob Storage using REST API with SAS
body: <p>I am attempting to call a Azure Storage Blob container using Postman with no luck.</p>
  
  <p>Here is my javascript code for generating the Shared Access Signature:</p>
  
  <pre><code>&lt;script src="https://github.com/dmester/sffjs/blob/master/src/stringformat.js"&gt;&lt;/script&gt;
  &lt;script src="https://github.com/Caligatio/jsSHA/blob/master/src/sha256.js"&gt;&lt;/script&gt;
  
  var method = "GET";
  
  //Build Date in UTC
  var dateInRfc1123Format = new Date();
  dateInRfc1123Format = dateInRfc1123Format.toUTCString();
  console.log(dateInRfc1123Format);
  
  //Azure Blob Account Info
  var accountName = "siteassets";
  var containerName = "test";
  var key = "superSecretOmitted";
  
  //Required Stuff
  var canonicalizedHeaders = String.format("x-ms-date:{0}\nx-ms-version: 2009-09-19\n", dateInRfc1123Format);
  var canonicalizedResource = String.format("/{0}/{1}/", accountName, containerName);
  
  // Building the string that will need signed with my key
  var stringToSign = String.format("{0}\n\n\n\n\n\n\n\n\n\n\n\n{1}{2}", method, canonicalizedHeaders,
              canonicalizedResource);
  console.log("stringToSign: " + stringToSign);
  
  //Create Base64 SHA256 Hash
  var shaObj = new jsSHA("SHA-256", "TEXT");
  shaObj.setHMACKey(key, "TEXT");
  shaObj.update(stringToSign);
  var hmac = shaObj.getHMAC("B64");
  var signature = hmac;
  
  //Build the Authorization Header for the request and print to console
  var authorizationHeader = String.format("SharedKey {0}:{1}", accountName,
              signature);
  
  console.log(authorizationHeader);
  </code></pre>
  
  <p>At this point I grab that <code>authorizationHeader</code>output from the browser console and paste it in Postman. It looks something like this: <code>SharedKey siteassets:/4B2VjY9ZhsFxNngwhj8A9qeZC2chTQNmB1kEvyd+fM=</code></p>
  
  <p>Heres my Postman settings:
  <img src="https://i.stack.imgur.com/ANmHE.png" alt="enter image description here"></p>
  
  <p>Postman returns a 403 error with this output:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Error&gt;
      &lt;Code&gt;AuthenticationFailed&lt;/Code&gt;
      &lt;Message&gt;Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
  RequestId:ed8376ec-0001-0055-54ed-a97527000000
  Time:2015-06-18T17:40:05.3456247Z&lt;/Message&gt;
      &lt;AuthenticationErrorDetail&gt;The MAC signature found in the HTTP request '/4B2VjY9ZhsFxNngwhj8A9qeZC2chTQNmB1kEvyd+fM=' is not the same as any computed signature. Server used following string to sign: 'GET
  
  
  
  
  
  
  
  
  
  
  
  x-ms-date:Thu, 18 Jun 2015 17:39:45 GMT
  x-ms-version:2009-09-19
  /siteassets/test
  comp:list
  restype:container'.&lt;/AuthenticationErrorDetail&gt;
  &lt;/Error&gt;
  </code></pre>
  
  <p>What in the world am I doing wrong?</p>