4
votes

I'm trying insert an item to Azure Table Storage using a shared access key that has been generated using a secured web service (in order to keep the key secure). My problem is that I am getting a 400 (Bad Request) error. Please can someone tell me what I am doing wrong?

I return a Uri with the SaS on it from the service, e.g.

https://myaccount.table.core.windows.net/l4nlog?sv=2012-02-12&se=2013-02-18T17:42:58Z&tn=L4NLog&sp=a&sig=rGImh0XZ8KcbMI+k1JuNvGGfq13UioYaQFXxg+M1an0=

I then add the information for the table to the request stream in the format as specified on Microsoft's website (EXCEPT that the attribute for the Atom namespace is defined as xmlns:a="http://www.w3.org/2005/Atom"):

http://msdn.microsoft.com/en-us/library/windowsazure/dd894033.aspx

I also add: request.Method = "POST"; request.ContentType ="application/atom+xml" x-ms-date is in RFS1123 format

However, I am not setting the Authorization header (which is probably my downfall), because I am presuming the SaS should do the job for me.

So, any pointers would be very gratefully appreciated...!

Forgive me if I've missed any information...

Steve

1
For anyone who wants to know, it appears as if my problem was a namespace issue with the xml for the RequestStream. The Authorization header is not required when specifying a shared access signature.Steve McShane
I have the similar problem once and was my PC datetime. Once of the Azure requirements is that the time of the request should have a maximum delay of 15m and I changed my time testing another stuffMiguel

1 Answers

0
votes

This is a hard problem. This error means that something is wrong in your request. I suggest to try the following thing:

1-) Verify that the SaaS service is pointing to the correct version of the Storage Service API (1.6, 1.7, 1.8, or any other)

2-) Verify the request restrictions for Azure Table Storage

3-) Yes you will need to verify the Authentication of the request, (but i think that this isn't the problem)