I am calling the Azure REST List Subscription Operation.
On my dev machine I have installed the certificate in to Current User\Personal. I can successfully call the API and get a response back. Response code = 200
On a test box I have installed the same certificate in to Current Use\Personal. I cannot call the API. I get a 403 forbidden. Full error below:
<Error>
<Code>AuthenticationFailed</Code>
<Message>The server failed to authenticate the request.
Verify that the certificate is valid and is associated with this subscription.
</Message>
</Error>
So I check the certificate, it is valid from earlier today (as it was imported today) and valid to January 2040. So I presume it is valid?
Questions:
- The same code/project/service works on my local machine but not on the test box. Why?
- The certificate thumbprint is the same, the certificates are the same. The certificate is associated to the Subscription azure account because it works locally! Why?
What else should I check? I know that both the local and the test box service attaches the certificate to the web request (I know this through verbose logging) but at the point of
HttpWebResponse webResponse = webRequest.GetResponse() as HttpWebResponse;
I receive the 403 forbidden error.
Going out of my mind on this one.
Update:
In the response which I view in Fiddler, the beginning of the response is:
HTTP/1.1 403 Forbidden
Content-Length: 294
Content-Type: application/xml; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Sep 2013 02:49:59 GMT
Now I am wondering whether the Date part is the issue. I remember reading that the Date must be within 15 minutes of the request. On the test box the current time is 12:49pm so it seems the date returned is "ahead" by 2 hours. Could this be why? Or is that response just Fiddlers interpretation of a date?