Saturday, June 4, 2011

Microsoft Azure Server failed to authenticate the request

Microsoft Azure cloud platform is gaining popularity in leaps and bounds. I was one of the fortunate people to try my hands early on this platform. Although, the coding is a breeze with Microsoft Azure there are sometimes some silly errors that will make your head go crazy thinking about it. There are some issues with development environment vs cloud environment too that make you wonder if there is something wrong on your end or is it the Azure itself causing bugs. The error that I got was "Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.". It took me a lot of time to figure it out. This post is dedicated to that problem.


Azure Server failed to authenticate the request solution


If you are stuck with this problem the first thing to check is your system time. What happened in my case was that my PC got restarted and the local time (PC time) for some odd reason was set to west coast's time zone. I am, however, on the east coast. Due to this the timing that was sent with my REST API requests were too old. Due to this the cloud server will assume that the request was too old and hence expired. Thus, whenever I tried to connect to my blob storage account I got this message back:

The remote server returned an error: (403) Forbidden.

Request URI: https://gpcoverlay.blob.core.windows.net/?restype=container&comp=list&$maxresults=1
Response Headers:
x-ms-request-id: 0b2ee09c-0c64-410a-8320-8c17b0fb461a
Content-Length: 435
Content-Type: application/xml
Date: Mon, 23 May 2011 22:15:31 GMT
Server: Microsoft-HTTPAPI/2.0
Error Details:
Code: AuthenticationFailed
Message: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:0b2ee09c-0c64-410a-8320-8c17b0fb461a
Time:2011-05-23T22:15:32.4495690Z
AuthenticationErrorDetail: Request date header too old: 'Mon, 23 May 2011 19:15:30 GMT'
Error Code: HTTP Status Code: (403)


After a careful observation I figured that the error details mentioned timing. I had to check everything else before I could zero down on true problem. You, on the other hand, know better now and I hope it will help someone somewhere to get rid of this issue. There is a great book on Microsoft Azure if you are interested -Programming Windows Azure: Programming the Microsoft Cloud - available on Amazon for about 30 bucks.

19 comments:

  1. Huh? How is this helpful?

    ReplyDelete
  2. Thanks. I spent 5 hours trying to figure this one out. The above commenter is a hater a$$hole. You are a scholar.

    - John

    ReplyDelete
  3. I don't recieve AuthenticationErrorDetail element in response. Is there a way to enable it?

    ReplyDelete
  4. Dear Anony,

    There are a number of reasons for this error. Could you post the response and I will try to see if I can figure out the reason.

    Regards,
    Dinesh

    ReplyDelete
  5. Thanks. My clock has readjusted itself for some reason, and the error message is basically "something is wrong :("... so...

    THANK YOU!

    ReplyDelete
  6. Dear Anony,

    My clock had the same issue. I guess it had something to do with one of the window updates. Anyways, all well that ends well.

    Reagrds,
    Dinesh

    ReplyDelete
  7. Thanks! That's the exact problem I had but had over looked it.

    ReplyDelete
  8. Thanks, this problem occurred due to my system's current time was not matched from Actual Date time, when I changed the system's date time to actual time, every thing working fine.

    ReplyDelete
  9. The Storage Location, Cloud Service Location and my Computer Location are the same and I´m getting this error...Help me Pls!

    ReplyDelete
  10. Just ran into this problem myself - thank you so much for the enlightenment :)

    ReplyDelete
  11. Thank you!
    You sir, are a scholar and a gentleman.

    ReplyDelete
  12. this is helpful, had the same issue thanks

    ReplyDelete
  13. Had the same symptoms.
    Website and storage were located in different regions (North-/East-Europe).
    Linked everything to North-Europe.
    Problem solved...

    ReplyDelete
  14. THANK YOU

    I AM JEWISH, WHICH MEANS I LOVE YOU MORE THAN JESUS

    ReplyDelete
  15. AuthenticationFailed
    Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    RequestId:e3df46d8-001a-008a-3e89-6c6156000000
    Time:2017-01-12T04:09:11.0276576Z
    The Date header in the request is incorrect.

    My Inputs:
    Request uri : https://myaccount.file.core.windows.net/myshare/mydirectorypath/myfile

    Header Params
    x-ms-content-length : 1024
    Authorization : SharedKey myaccount:6yg7omlMPAbZ7zHFQuqSMC2gU2hC3fawg8PtLsNVEFA%3D
    x-ms-version : 2015-12-11
    x-ms-date : Wed, 11 Feb 2017 17:35:00 GMT

    ReplyDelete
  16. Thank you sir, you saved my time

    ReplyDelete