2
votes

I am getting 500 Internal Server Error back from the Azure REST management API with this request. Why?

X509Certificate cert = X509Certificate2.CreateFromCertFile(cert_path);
string uri = String.Format("https://management.core.windows.net/{0}/services/hostedservices/{1}/deploymentslots/staging",
                           SUBSCRIPTION_ID, SERVICE_NAME);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Headers.Add("x-ms-version", "2009-10-01");
request.ClientCertificates.Add(managementCertificate);
request.GetResponse();

SUBSCRIPTION_ID contains the Subscription ID copied from the Management Portal (only one subscription). SERVICE_NAME contains the DNS Prefix from the only hosted service. These URIs work fine:

https://management.core.windows.net/{0}/services/hostedservices
https://management.core.windows.net/{0}/services/hostedservices/{1}?request-detail=true

The latter request even lists the staging deployment and indicates all is well.

The certificate was made according to Microsoft's makecert instructions using the Windows SDK 7.1. Deployment was uploaded manually.

1
Not a solution, but Lokad.Cloud (code.google.com/p/lokad-cloud) has implemented its one C# wrapper for the Management API. We have been struggling a lot on that one to get it working. You might find some nuggets in the code. Hope it helps.Joannes Vermorel
If you were having issues with this on July 6th and 7th there was an issue with DNS, which was effecting the Azure Management service. It was fixed later in the day, on the 7th. Not sure if that's your issue as well, but I was getting 500 errors for no reason on the 6th and 7th as well.Richard Anthony Freeman-Hein
Based on @Richard Hein's comment I have submitted a support ticket to Microsoft.Oliver Bock
@Joannes: I looked a bit at lokad, but I could not find the relevant bit of source. The source seemed very clever, but a bit mysterious.Oliver Bock

1 Answers

2
votes

I submitted the problem to Microsoft support. They have indicated that there is a bug in Azure that is triggered when your DNS Prefix is only one character in length.