I get the following error when accessing the URL https://management.core.windows.net/<subscription-id>/services/hostedservices" using curl:
<Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><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>
I created a key pair and a self-signed X.509 v3 certificate (2048 bits) using openssl and associated the certificate with my subscription.
Here is the curl command that I am using to access the above URL:
I have been struggling with this issue for couple of days now. Initially wrote a java client that uses noelios restlet engine to call windows azure service management REST API. Didn't have any luck in that route so tried to use openssl and curl, but still
having problem using the REST API.
Will really appreciate if someone can provide resolution to this issue.
I tried it now and was able to list my hosted services but I must tell you that this is the first time I tried this (in fact I heard about this today only [What can you say, typical Windows Guy!!! :)]) so I will write what exactly I did. I did this on Windows
7 (64 bit).
1. I had a self signed certificate (*.pfx) from which I exported and created a .cer file. This file is uploaded under API certificate section in Windows Azure portal.
2. I downloaded and installed GnuWin from SourceForge.Net (http://sourceforge.net/projects/gnuwin32/files/openssl/0.9.8h-1/openssl-0.9.8h-1-setup.exe/download).
3. I download and unzipped curl (7.21.0).
4. I then created a .pem file from my pfx file using the following command: C:\Program Files (x86)\GnuWin32\bin>openssl pkcs12 -in D:\mycert.pfx -out D:\mycert.pem.
5. I had to modify your curl command above (especially the x-ms-version header value). Basically this is what I tried:
Once I executed that command, it asked me for a password (PEM pass phrase) and it listed all the hosted services under my subscription in XML format. Please feel free to make any corrections in what I did and post it here so that other users can benefit