title: REST Api to Azure blob storage using Access key
body: <p>We are trying to access the blobs from azure blob storage without using the Azure SDK,</p>
  
  <p>we are trying to access through the shared key by Azure REST API, for that we need to generate the Authorization header, but when I try to create a signature from the Access key I am getting the following error</p>
  
  <p>"Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature."</p>
  
  <p>"The MAC signature found in the HTTP request 'key hash' is not the same as any computed signature"</p>
  
  <p>Need help to generate proper authorization header, we have followed the documentation </p>
  
  <p><a href="https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key</a></p>
  
  <p><a href="https://docs.microsoft.com/en-gb/rest/api/storageservices/authorization-for-the-azure-storage-services?redirectedfrom=MSDN" rel="nofollow noreferrer">https://docs.microsoft.com/en-gb/rest/api/storageservices/authorization-for-the-azure-storage-services?redirectedfrom=MSDN</a></p>
  
  <p>We have tried in postman as well, and we are getting the same error.</p>
  
  <pre><code>     string signWithAccountKey(string stringToSign, string accountKey)
       {
              var hmacsha = new System.Security.Cryptography.HMACSHA256();
              hmacsha.Key = Convert.FromBase64String(accountKey);
              var signature = hmacsha.ComputeHash(Encoding.UTF8.GetBytes(stringToSign));
              return Convert.ToBase64String(signature);
       }
  </code></pre>
  
  <p>The MAC signature found in the HTTP request 'key hash' is not the same as any computed signature</p>