I'm tyring to use the MetricsClient to get the metrics for a web role (http://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.management.monitoring.metrics.metricsclient.aspx) to query for existing metric definitions, but I get a 404 and an"invalid request" json response content. The AutoscalingClient works fine for the same resource id.
The call looks like this, as straightforward as it gets:
var cert = GetCertificate(StoreName.My, StoreLocation.CurrentUser, certThumbprint);
var metricsClient = new MetricsClient(new CertificateCloudCredentials(subscriptionId, cert));
var resourceId = AutoscaleResourceIdBuilder.BuildCloudServiceResourceId(cloudServiceName, roleName, isProduction);
var definitions = metricsClient.MetricDefinitions.List(resourceId, null, null);
Using Fiddler I see that the request goes to https://management.core.windows.net/[sub id]/services/monitoring/metricdefinitions/query?&resourceId=%2Fhostedservices%2F[service name]%2Fdeploymentslots%2FProduction%2Froles%2F[role name], and the response I get back is (typo included):
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">{"Code":"InvalidRequest","Message":"Could not retireve the metric definitions."}</string>
Is there something I should be doing differently?