Getting 403 Authorization header issue with Signature with Azure Free Trail storage account

Hi All,

I am new to Azure service. I have created a Azure storage account and created a public container.

I tried to upload a BlockBlob using HTTP PUT. To create the authorization header it is asking me to input secretKey for HMAC signature signing. What is the secretKey? Is it a  PRIMARY ACCESS KEY or SECONDARY ACCESS KEY of my storage account ? or my account password?

And what is the x-ms-version for my Trail storage account and where to find it?

I always get 403 HTTP error complaining about signed authorization signature invalid. Where to find the sample for my trail storage account?

Here is the error- "403 Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature"

Please help me in getting the solutions.

Here is the java code I am using to construct the auth signature.

---------------------------------------------------------------

public String sign(String stringToSign, String accessKey){

//Generate Signed context           
SecretKey hmacKey = new SecretKeySpec(accessKey.getBytes(), "hmacSHA256");
Mac mac = Mac.getInstance("hmacSHA256");
mac.init(hmacKey);

byte[] digest=mac.doFinal(stringToSign.getBytes("UTF8"));

String encodedStringToSign = new String(Base64.encodeBase64(digest));

System.out.println(" encodedStringToSign-->" + encodedStringToSign);
return encodedStringToSign;

  }
 catch (  Exception e) {
throw new IllegalArgumentException("accessKey",e);
  }
}

----------------------------------------------------------------

   Thanks,

Sanjay




  • Edited by SanjuK 4 hours 35 minutes ago
August 30th, 2015 10:26pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics