Forum Discussion
Running Commands Across VM Scale Set Instances Without RDP/SSH Using Azure CLI Run Command
This is a useful pattern for operations work. The main thing to call out is that VMSS Run Command is instance-scoped, so for a whole scale set you normally enumerate instances and invoke the command per instance ID.
For ad hoc work, that is fine: list the current instances, loop through them, run the command, and collect output/errors centrally. For repeatable configuration, I would avoid Run Command as the primary mechanism and use cloud-init, Custom Script Extension, VM applications, image baking, or an extension-based automation approach instead.
That distinction helps keep Run Command for break/fix and inspection, while your baseline state remains declarative and reproducible.
CLI reference: https://learn.microsoft.com/cli/azure/vmss/run-command