删除订阅中Azure资源组的列表,而无需使用Azure CLI确认

发布于 2025-02-12 01:29:10 字数 179 浏览 2 评论 0原文

我想在单个CLI命令中删除订阅中的所有资源组。我使用管道操作员删除所有资源组:(

get-azResourceGroup | remove-azResourceGroup)。

虽然Azure顺序删除组,但提示为每个资源组确认确认。是否有一种方法可以强制删除Azure CLI中的所有资源组,而不会遇到CLI的确认。

I want to delete all the resource groups in a subscription in a single cli command. I used pipeline operator to delete all the resource groups:

(Get-AzResourceGroup | Remove-AzResourceGroup).

While azure deletes the groups sequentially, it prompts for confirmation for each resource group. Is there a way to force delete all resource groups in Azure cli without encountering the confirmation from the CLI.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

活雷疯 2025-02-19 01:29:10

我们可以使用此Power Shell脚本在订阅中删除所有资源组。
删除所有名称与过滤器匹配的资源组

$filter = 'rg-devenvironment' 
Get-AzResourceGroup | ? ResourceGroupName -match $filter | Remove-AzResourceGroup -AsJob -Force

We can use this power shell script to delete all resource groups in a subscription.
Delete All resource groups whose names match with the filter

$filter = 'rg-devenvironment' 
Get-AzResourceGroup | ? ResourceGroupName -match $filter | Remove-AzResourceGroup -AsJob -Force
毁虫ゝ 2025-02-19 01:29:10

请使用-force参数删除资源组,而无需确认。

从此-group-without-confircation“ rel =“ nofollow noreferrer”> link

Get-AzResourceGroup -Name "ContosoRG01" | Remove-AzResourceGroup -Force

此命令使用get-azResourceGroup cmdlet获取资源
组contosorg01,然后将其传递给通过
使用管道操作员。 力参数抑制
确认提示

Please use -Force parameter to remove resource group without confirmation.

From this link:

Get-AzResourceGroup -Name "ContosoRG01" | Remove-AzResourceGroup -Force

This command uses the Get-AzResourceGroup cmdlet to get the resource
group ContosoRG01, and then passes it to Remove-AzResourceGroup by
using the pipeline operator. The Force parameter suppresses the
confirmation prompt
.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文