1
votes

I'm testing the REST API to create an auto scaling rule. However the following error occurs:

HTTP/1.1 500 Internal Server Error

The server encountered an internal error. Please retry the request

I'm using SOAPUI tool as REST client.

The request is apparently according https://msdn.microsoft.com/en-us/library/azure/dn510372.aspx

What's wrong?

Where can I find examples of creating Auto Scaling using REST API ?

Below is the HTTP request body in json

Thanks!

{
"Profiles": [
{
  "Name": "name-of-profile-ONE",
  "Capacity": {
    "Minimum": "1",
    "Maximum": "3",
    "Default": "1"
  },
  "Rules": [
    {
      "MetricTrigger": {
        "MetricName": "Percentage CPU", 
        "MetricNamespace": "",        
        "MetricSource": "/VirtualMachinesAvailabilitySet/test/set2",
        "TimeGrain": "PT5M",
        "Statistic": "Average",
        "TimeWindow": "PT45M",
        "TimeAggregation": "Average",
        "Operator": "GreaterThanOrEqual",
        "Threshold": "80"
      },
      "ScaleAction": {
        "Direction": "Increase",
        "Type": "ChangeCount",
        "Value": "1",
        "Cooldown": "PT20M"
      },
    },
{
      "MetricTrigger": {
        "MetricName": "Percentage CPU",
        "MetricNamespace": "",
        "MetricSource": "/VirtualMachinesAvailabilitySet/test/set2",
        "TimeGrain": "PT5M",
        "Statistic": "Average",
        "TimeWindow": "PT45M",
        "TimeAggregation": "Average",
        "Operator": "LessThanOrEqual",
        "Threshold": "60"
      },
      "ScaleAction": {
        "Direction": "Decrease",
        "Type": "ChangeCount",
        "Value": "1",
        "Cooldown": "PT20M"
      },
    },  
  ],
}
],
"Enabled": true
}   
1

1 Answers

0
votes

I found a mistake in json. Follow the correct json ...

Thanks

{
"Profiles": [
{
  "Name": "name-of-profile-UM",
  "Capacity": {
    "Minimum": "1",
    "Maximum": "3",
    "Default": "1"
  },
  "Rules": [
    {
      "MetricTrigger": {
        "MetricName": "Percentage CPU",
        "MetricNamespace": "",
        "MetricSource": "/VirtualMachinesAvailabilitySet/romulo101s/set2",
        "TimeGrain": "PT5M",
        "Statistic": "Average",
        "TimeWindow": "PT45M",
        "TimeAggregation": "Average",
        "Operator": "GreaterThanOrEqual",
        "Threshold": "80"
      },
      "ScaleAction": {
        "Direction": "Increase",
        "Type": "ChangeCount",
        "Value": "1",
        "Cooldown": "PT20M"
      }
    },
    {
      "MetricTrigger": {
        "MetricName": "Percentage CPU",
        "MetricNamespace": "",
        "MetricSource": "/VirtualMachinesAvailabilitySet/romulo101s/set2",
        "TimeGrain": "PT5M",
        "Statistic": "Average",
        "TimeWindow": "PT45M",
        "TimeAggregation": "Average",
        "Operator": "LessThanOrEqual",
        "Threshold": "60"
      },
      "ScaleAction": {
        "Direction": "Decrease",
        "Type": "ChangeCount",
        "Value": "1",
        "Cooldown": "PT20M"
      }
    }
  ]
}
],
"Enabled": true
}