From 02aaa71b6e57567af05e3752b3682dc205559cca Mon Sep 17 00:00:00 2001 From: franzforti Date: Fri, 5 Jun 2026 16:06:12 +0200 Subject: [PATCH] Limit VM and VMSS queries to first 300 results --- bash/lw_azure_inventory.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash/lw_azure_inventory.sh b/bash/lw_azure_inventory.sh index 9810eaa..8920a2b 100755 --- a/bash/lw_azure_inventory.sh +++ b/bash/lw_azure_inventory.sh @@ -166,9 +166,9 @@ function runAnalysis { local expectedSubscriptions=$(az graph query -q "resourcecontainers | where type == 'microsoft.resources/subscriptions' | project name, subscriptionId" $scope -o json) local expectedSubscriptionIds=$(echo $expectedSubscriptions | jq -r '.data[] | .subscriptionId' | sort) echo Load VMs - local vms=$(az graph query -q "Resources | where type=~'microsoft.compute/virtualmachines' | project subscriptionId, name, sku=properties.hardwareProfile.vmSize, powerState=properties.extended.instanceView.powerState.code" $scope -o json) + local vms=$(az graph query -q "Resources | where type=~'microsoft.compute/virtualmachines' | project subscriptionId, name, sku=properties.hardwareProfile.vmSize, powerState=properties.extended.instanceView.powerState.code" $scope -first 300 -o json) echo Load VMSS - local vmss=$(az graph query -q "Resources | where type=~ 'microsoft.compute/virtualmachinescalesets' | project subscriptionId, name, sku=sku.name, capacity = toint(sku.capacity)" $scope -o json) + local vmss=$(az graph query -q "Resources | where type=~ 'microsoft.compute/virtualmachinescalesets' | project subscriptionId, name, sku=sku.name, capacity = toint(sku.capacity)" $scope -first 300 -o json) local actualSubscriptionIds=$(echo $vms | jq -r '.data[] | .subscriptionId' | sort | uniq)