question

ItayTalCloudTeamai-3891 avatar image
0 Votes"
ItayTalCloudTeamai-3891 asked ItayTalCloudTeamai-3891 commented

VMSS - powershell for describing the VMSS autoscale type

Hi
I trie to list all my VMSS with manual scale, for creating a list of VMSS and change them into auto-scale
I couldn't find the powershell command to retrieve this information

Get-AzVmss -ResourceGroupName "Group001" -VMScaleSetName "VMSS001"

is not describing the scale type

Any idea how to find all those resources?

windows-server-powershellazure-virtual-machines-scale-set
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

srbose-msft avatar image
0 Votes"
srbose-msft answered ItayTalCloudTeamai-3891 commented

@ItayTalCloudTeamai-3891 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.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ItayTalCloudTeamai-3891 , If you want to check in all resource groups in the subscription you can use the following cmdlet:

 Get-AzResourceGroup |
 >> % {
 >>    $RG = $_.ResourceGroupName
 >>    Get-AzAutoscaleSetting -ResourceGroupName $RG -WarningAction Ignore | Format-list Enabled,Name,TargetResourceUri
 >> }
0 Votes 0 ·

Thanks!
Its the missing link!

0 Votes 0 ·
RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered ItayTalCloudTeamai-3891 commented

Are you saying that the "Type" property isn't found in the results? I'm not at all familiar with Azure, but does adding the -InstanceView parameter to the cmdlet help?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RichMatheisen-8856
The Type is always the same and is not describing the scaling type
"Type : Microsoft.Compute/virtualMachineScaleSets"
I am looking for the autoscale type
-InsanceView is giving me info about the instances that belong to this VMSS, nothing about the auto/manual policy

0 Votes 0 ·
RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered ItayTalCloudTeamai-3891 commented

Have a look at the cmdlets that match: Get-<asterisk>autoscal<asterisk>

I had to spell out "asterisk" where you should use "*" because of this forum's editor interprets paired asterisks as meaning "italicize this text".

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

thanks @RichMatheisen-8856
This commands gives me the details for autoscale if I know the autoscale name, to the autoscale resource group
I am looking for the connection between the VMSS and the autoscale so I will figure out which VMSS is using which autoscale
Your reply is great but not for this problem that I mention in the first place

0 Votes 0 ·