如何使用 powershell 删除所有 Azure 资源 [英] How to delete ALL Azure resources with powershell

查看:30
本文介绍了如何使用 powershell 删除所有 Azure 资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从所有资源中清空我的 Azure 帐户,并且在门户中需要单独删除太多资源.寻找一个powershell脚本来做到这一点.谢谢.

I need to empty my Azure account from all resources and there's too much to remove individually in the portal. Looking for a powershell script to do this. Thanks.

推荐答案

由于 Azure 中的资源被分组到资源组 (RG) 中,这可能是解决此问题的最简单方法.使用这些 cmdlet 执行此操作.

As resources in Azure are grouped into resource groups(RG), that would probably be the easiest way to go about this. Use these cmdlets to do this.

删除-AzureRmResourceGroup

检索完所有 RG 后,您可以使用 | 管道传输结果.字符添加到 Remove cmdlet 并使用 ForEach 循环遍历它们.试一试,这是最好的学习方式,而不是在这里简单地寻求解决方案.

Once you have retrieved all the RGs, you can pipe the results with the | character to the Remove cmdlet and iterate through them with a ForEach loop. Give it a go, it is the best way to learn, as opposed to simply asking for the solution on here.

或者,如果您不想使用 powershell,只需从门户中删除您的 RG.我假设您认为这会花费太长时间,因为您正在查看单个资源而不是它们的 RG,但如果您确实拥有那么多 RG,那么最好编写脚本.

Alternatively, if you don't want to use powershell, just delete your RGs from the portal. I assume you think it would take too long because you are looking at the individual resources and not their RGs, but if you really do have that many RGs, then scripting is best.

这篇关于如何使用 powershell 删除所有 Azure 资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆