Hi Anil Kumar,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
To fetch auto-scaling details for all your Virtual Machine Scale Sets (VMSS) in a straightforward way:
To get a list of all Virtual Machine Scale Sets, use the following query:
kql
Copy code
resources
| where type == "microsoft.compute/virtualmachinescalesets"
| project id, name, location
To retrieve auto-scaling settings for your Virtual Machine Scale Sets, use this query:
kql
Copy code
resources
| where type == "microsoft.insights/autoscalesettings"
| project id, name, properties
To combine Virtual Machine Scale Sets with their auto-scaling settings, use this query:
kql
Copy code
let vmss = resources
| where type == "microsoft.compute/virtualmachinescalesets"
| project vmssId = id, vmssName = name;
let autoscale = resources
| where type == "microsoft.insights/autoscalesettings"
| project autoscaleId = id, autoscaleName = name, autoscaleProperties = properties;
vmss
| join kind=leftouter (autoscale) on $left.vmssId == $right.autoscaleId
| project vmssId, vmssName, autoscaleName, autoscaleProperties
Run the VMSS query to list all scale sets, the auto-scaling query to get scaling settings, and combine them to match each VMSS with its scaling configuration.
If Insights is not enabled, Some VMSSs may not have auto-scaling data, and ensure you have the necessary permissions to access both VMSS and auto-scaling information.
If you have any further queries, do let us know
If the answer helpful, please click the "Accept Answer" And "upvote"