Adventure with Azure: Cleaning House

My Azure subscription is out of control with resource groups, many of which I have no idea what they are even for?!

What to do?!

I just repaved my laptop, why not repave my Azure subscription?!

I fired up my terminal and create a script to get the job done.

$resources = az group list | ConvertFrom-Json

foreach ($resource in $resources) {
    Write-Host $resource.name

    az group delete -n $resource.name --no-wait -y
}

Ran the script, and bingo, all my resource groups gone!

Use at your own risk!


Discover more from Matt Ruma

Subscribe to get the latest posts sent to your email.

1 Reply to “Adventure with Azure: Cleaning House”

  1. do you know how to list out
    list of resigned users with active accounts
    list of multifactor disabled AD accounts

Leave a Reply

Your email address will not be published. Required fields are marked *