@Itay Tal | CloudTeam.ai Thank you for your question. AutoscaleSettings
is not a property of the resource of type Microsoft.Compute/virtualMachineScaleSets
. When you enable autoscaling on a Virtual Machine Scale Set a resource of type Microsoft.Insights/autoscaleSettings
is deployed, which looks something like the following:
{
"type": "Microsoft.Insights/autoscaleSettings",
"apiVersion": "2015-04-01",
"name": "[variables('autoScaleResourceName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachineScaleSets/', parameters('virtualMachineScaleSetName'))]"
],
"properties": {
"name": "[variables('autoScaleResourceName')]",
"targetResourceUri": "[variables('vmssId')]",
"enabled": true,
"profiles": [
{
"name": "Profile1",
"capacity": {
"minimum": "[parameters('autoScaleMin')]",
"maximum": "[parameters('autoScaleMax')]",
"default": "[parameters('autoScaleDefault')]"
},
"rules": [
{
"metricTrigger": {
"metricName": "Percentage CPU",
"metricNamespace": "",
"metricResourceUri": "[variables('vmssId')]",
"timeGrain": "PT1M",
"statistic": "Average",
"timeWindow": "[concat('PT', parameters('durationTimeWindow'), 'M')]",
"timeAggregation": "Average",
"operator": "GreaterThan",
"threshold": "[parameters('scaleOutCPUPercentageThreshold')]"
},
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "[parameters('scaleOutInterval')]",
"cooldown": "PT1M"
}
},
{
"metricTrigger": {
"metricName": "Percentage CPU",
"metricNamespace": "",
"metricResourceUri": "[variables('vmssId')]",
"timeGrain": "PT1M",
"statistic": "Average",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "LessThan",
"threshold": "[parameters('scaleInCPUPercentageThreshold')]"
},
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": "[parameters('scaleInInterval')]",
"cooldown": "PT1M"
}
}
]
}
]
}
}
By default the value of the autoScaleResourceName
variable will be defined as "autoScaleResourceName": "[concat(parameters('virtualMachineScaleSetName'), 'autoscale')]"
For example, if your Virtual Machine Scale Set name is test then the AutoscaleSettings name will be testautoscale.
So to get autoscale settings information you can use Get-AzAutoscaleSetting command
For example:
Get-AzAutoscaleSetting -ResourceGroupName $RG -WarningAction Ignore | Format-list Enabled,Name,TargetResourceUri
Output:
Enabled : True
Name : testautoscale
TargetResourceUri : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/$RG/providers/Microso
ft.Compute/virtualMachineScaleSets/test
----------
Hope this helps!
Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.