I want to start the VM that have specific tag.
For example if my VM having the tag as Dept:Finance then by using azure cli command az vm start
I should able to start the vms which are having the above tag.
I found one CLI command that will give the list of vms that was having the same tag like below
az resource list --tag Dept=Finance
By using the above command how I can start the above tag associated VMs
Please help me with the Azure CLI command to start the vms that are having the same tag.
2
Answers
Using PowerShell:
I have reproduced in my environment and got expected results:
In Azure CLI:
Here i have taken
dept and finance
as tag when creating Vm and I followed Microsoft-Document :Output:
In Azure PowerShell:
Alternatively you can do in PowerShell to get vms started as below:
Here i have taken
dept and finance
as tag when creating Vm and I followed Microsoft-Document :Use below script to start Vms with similar tag:
Output: