如何使用 Azure CLI cmdlet 强制删除所有资源组而不提示确认?

问题描述 投票:0回答:2

找到类似的问题,但答案在 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
azure azure-cli
2个回答
1
投票

请尝试以下操作:

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


0
投票

az 组列表 --query "[?location=='centralindia'|| location=='eastus']".name -o tsv | xargs -otl az 组删除 -y -n

© www.soinside.com 2019 - 2024. All rights reserved.