Found that there was no proper example available how to do this in BASH, which I use often these days.
Without confirmation
#WSL or other Linux distro
G=$(az group list --tag 'svc=aksdev' --query "[].{name:name}" -o tsv)
for res in $G
do
echo "az group delete --id $res"
az group delete --name $res --no-wait -y
done
With confirmation
#WSL or other Linux distro
G=$(az group list --tag 'svc=aksdev' --query "[].{name:name}" -o tsv)
for res in $G
do
echo "az group delete --id $res"
az group delete --name $res --no-wait
done

0 comments on “AZ CLI – Delete tagged groups in bash”