Supreeth J

Supreeth J

  • 835
  • 721
  • 56.4k

MS Azure shared key by Azure REST API

Jun 26 2019 8:32 AM
we are trying to access the blobs from azure blob storage without using the Azure SDK,
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
"Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature."
"The MAC signature found in the HTTP request 'key hash' is not the same as any computed signature. Server used following string to sign: 'GET'"
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);
}
need help to generate proper authorization header, we have followed the documentation
 
 https://docs.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key
 
 https://docs.microsoft.com/en-gb/rest/api/storageservices/authorization-for-the-azure-storage-services?redirectedfrom=MSDN
 
Regards
 
 

Answers (1)