Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy do calls to the Service Management API work but calls to the Scheduler API fail?
    text
    copied!<p>I'm trying to make some calls to the new <a href="http://msdn.microsoft.com/en-us/library/windowsazure/dn528946.aspx" rel="nofollow">Azure Scheduler API</a>. However, all my requests come back with this error:</p> <pre><code>&lt;Error xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;Code&gt;AuthenticationFailed&lt;/Code&gt; &lt;Message&gt;The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.&lt;/Message&gt; &lt;/Error&gt; </code></pre> <p>I'm pretty sure that I have everything setup correct because I can make calls using the same code and certificate to the <a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee460799.aspx" rel="nofollow">Azure Service Management API</a>. </p> <p>The code I'm using to attach the certificate to the web request is from the <a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee460782.aspx" rel="nofollow">MSDN Sample</a>. The Scheduler API calls that I've tried to make are the Check Name Availability, Create Cloud Service, and Create Job Collection. </p> <p>I've also verified that my subscription is Active for the preview of the Scheduler. </p> <p>Here is an example of a request I've tried:</p> <p><a href="http://msdn.microsoft.com/en-us/library/windowsazure/dn528943.aspx" rel="nofollow">Create Cloud Service</a></p> <blockquote> <p>Request A cloud service is created by submitting an HTTP PUT operation to the CloudServices OData collection of the Service Management API Tenant.Replace with your subscription ID and with your cloud service ID.</p> </blockquote> <p>So for this I create a web request pointing to:</p> <p>https://management.core.windows.net/[MySubId]/cloudServices/[MyNewServiceName]</p> <pre><code>HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestUri); // Define the requred headers to specify the API version and operation type. request.Headers.Add("x-ms-version", "2012-03-01"); request.Method = "PUT"; request.ContentType = "application/xml"; </code></pre> <p>Next I add the request body as specified in the documentation:</p> <pre><code>&lt;CloudService xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.microsoft.com/windowsazure'&gt; &lt;Label&gt;[MyServiceName]&lt;/Label&gt; &lt;Description&gt;testing&lt;/Description&gt; &lt;GeoRegion&gt;uswest&lt;/GeoRegion&gt; &lt;/CloudService&gt; </code></pre> <p>And finally I add the certificate that I use with my subscription to the account. </p> <pre><code>// Attach the certificate to the request. request.ClientCertificates.Add(certificate); </code></pre> <p>I try to get the response and instead I get the error shown above. </p> <p>BTW - I've also tried different regions thinking maybe it was a region issue since the scheduler isn't supported in all regions, but I still get the same response.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload