what trouble I met:
sa@DESKTOP-WEI:~$ az group list --query "[?name != 'product'].name" | jq -c '.[]' | while read g; do az group delete -n $g --no-wait -y; don
e
ValidationError: Parameter 'resource_group_name' must conform to the following pattern: '^[-\\w\\._\\(\\)]+$'.
what I've tried :
I tried to print $g
value,it looks like just normal string
sa@DESKTOP-WEI:~$ az group list --query "[?name != 'product'].name" | jq -c '.[]' | while read g; do echo $g; done
"NetworkWatcherRG"
I don't know why,but I changed to
for loop
to do it and it's workidea from : How to Delete Multiple Azure Resource Groups with Tags, Bash via Azure Cloud Shell, and the Azure CLI | Jon Gallant