找到类似的问题,但答案在 Azure PowerShell 中。
尝试使用以下 cmdlet 来删除特定位置的所有资源组:
az group list --query "[?location=='westus']".name -o tsv | xargs -otl az group delete -n
它要求我提示每次删除资源组。
还尝试通过阅读此
MS Doc,来添加标志
-y
az group list --query "[?location=='westus']".name -o tsv | xargs -otl az group delete -n -y
错误:
az group delete -n -y rg-105
argument --name/-n/--resource-group/-g: expected one argument
请尝试以下操作:
az group list --query "[?location=='westus']".name -o tsv | xargs -ot -n 1 az group delete -y -n
参考:https://github.com/Azure/azure-cli/issues/1398#issuecomment-276135930
az 组列表 --query "[?location=='centralindia'|| location=='eastus']".name -o tsv | xargs -otl az 组删除 -y -n