1
votes

Is it possible to get the list of all instances of a virtual machine scaleset from within the ARM template deployment as an output? I am deploying an ARM template which creates a virtual machine scaleset with 3 instances. As part of the deployment output, I want the list of all the VM's inside the scaleset. I have tried these so far -

"value": "[reference(concat('/subscriptions/SubscriptionID/resourceGroups/ResourceGrpName/providers/Microsoft.Compute/virtualMachineScaleSets/ScalesetName'), '2019-12-01', 'Full')]" - This only returns the scaleset information.

"value": "[reference(concat('/subscriptions/SubscriptionID/resourceGroups/ResourceGrpName/providers/Microsoft.Compute/virtualMachineScaleSets//virtualMachines'), '2019-12-01', 'Full')]" - This returns an error - "The resource namespace 'subscriptions' is invalid."

There is a similar REST API mentioned here - https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-instance-ids which works.

1

1 Answers

0
votes

it should be like this (i'm not sure it even works, tbh):

reference(concat(resourceId('SubscriptionID', 'ResourceGrpName', 
    'Microsoft.Compute/virtualMachineScaleSets', 'scaleSetName'),
    '/virtualMachines'), '2019-12-01', 'Full')]"

line breaks only for readability