Skip to content

Commit

Permalink
Add parameter to command deallocating workspace VMs (#2556)
Browse files Browse the repository at this point in the history
added parameter to deallocate query to list running VMs

added parameter to deallocate query to list running VMs

Co-authored-by: kolesnykandrii <kolesnyk.andrii@outlook.com>
Co-authored-by: Tamir Kamara <26870601+tamirkamara@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 7, 2022
1 parent 6fc3645 commit f707a1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion devops/scripts/control_tre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ elif [[ "$1" == *"stop"* ]]; then

# deallocating all VMs in workspaces
# RG is in uppercase here (which is odd). Checking both cases for future compatability.
az vm list --query "[?(starts_with(resourceGroup,'${core_rg_name}-ws') || starts_with(resourceGroup,'${core_rg_name^^}-WS')) && powerState=='VM running'][name, resourceGroup]" -o tsv |
az vm list -d --query "[?(starts_with(resourceGroup,'${core_rg_name}-ws') || starts_with(resourceGroup,'${core_rg_name^^}-WS')) && powerState=='VM running'][name, resourceGroup]" -o tsv |
while read -r vm_name rg_name; do
echo "Deallocating VM ${vm_name} in ${rg_name}"
az vm deallocate --resource-group "${rg_name}" --name "${vm_name}" &
Expand Down

0 comments on commit f707a1d

Please sign in to comment.