Q:

Azure autoscale metricname values

I need to define scale rule for my virtual machine I have read the following

The MetricName and MetricNamespace are not values I just made up.
These have to be precise.  You can get these values from the
MetricsClient API and there is some sample code in this link to show
how to get the values.
http://rickrainey.com/2013/12/15/auto-scaling-cloud-services-on-cpu-percentage-with-the-windows-azure-monitoring-services-management-library/

But its still not clear ho do I get a MetricName list of possible values as I didn't found any sample code for it

A:

Here is the code I used to get the available MetricNames for the cloud service.  It was part of a unit test project, hence the [TestMethod] attribute.
    [TestMethod]
    public async Task GetMetricDefinitions()
    {
        // Build the resource ID string.
        string resourceId = ResourceIdBuilder.BuildCloudServiceResourceId(
            cloudServiceName, deploymentName, roleName );

        Console.WriteLine("Resource Id: {0}", resourceId);

        //Get the metric definitions.
        var retrieveMetricsTask =
            metricsClient.MetricDefinitions.ListAsync(resourceId, null, null, CancellationToken.None);
        var metricListResponse = await retrieveMetricsTask;

        MetricDefinitionCollection metricDefinitions = metricListResponse.MetricDefinitionCollection;

        // Make sure something was returned.
        Assert.IsTrue(metricDefinitions.Value.Count > 0);

        // Display the metric definitions.
        int count = 0;
        foreach (MetricDefinition metricDefinition in metricDefinitions.Value)
        {
            Console.WriteLine("MetricDefinitio: " + count++);
            Console.WriteLine("Display Name: " + metricDefinition.DisplayName);
            Console.WriteLine("Metric Name: " + metricDefinition.Name);
            Console.WriteLine("Metric Namespace: " + metricDefinition.Namespace);
            Console.WriteLine("Is Altertable: " + metricDefinition.IsAlertable);
            Console.WriteLine("Min. Altertable Time Window: " + metricDefinition.MinimumAlertableTimeWindow);
            Console.WriteLine();
        }
    }

Here is the output of the test for my cloud service:

