List or remove Azure resources with Bash or PowerShell

Bash:

list:
az group list --query "[?starts_with(name,'az30301a-')]".name --output tsv
remove:
az group list --query "[?starts_with(name,'az30301a-')]".name --output tsv | xargs -L1 bash -c 'az group delete --name $0 --no-wait --yes'

PowerShell:

list:
Get-AzResourceGroup -Name ‘*’
remove:
Get-AzResourceGroup -Name ‘*’ | Remove-AzResourceGroup -Force -AsJob

Deploy with template and parameters file:

az deployment group create \ 
--resource-group az30301b-testRG \ 
--template-file azuredeploy30301rgb.json \ 
--parameters @azuredeploy30301rgb.parameters.json

10 Replies to “List or remove Azure resources with Bash or PowerShell”

  1. Wow that was strange. I just wrote an very long comment
    but after I clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyways, just wanted to say
    excellent blog!

  2. Simply to follow up on the up-date of this matter on your web page and wish to let you know simply how much I treasured the time you took
    to create this useful post. In the post, you really spoke on how to seriously
    handle this issue with all comfort. It would be my pleasure to collect some more ideas from your web-site and come up to offer some others what I
    have learned from you. I appreciate your usual terrific effort.

    Feel free to surf to my homepage … https://moonlightmining.com/

  3. I do not leave a response, but after looking at some of the remarks on List or remove Azure
    resources with Bash or PowerShell – python design. I
    actually do have some questions for you if it’s allright.
    Is it just me or do some of these comments look
    like they are coming from brain dead individuals?
    😛 And, if you are posting on additional social sites, I would like to keep up with you.

    Would you post a list of the complete urls of all your public pages like your twitter feed, Facebook page or linkedin profile?

    Here is my web site Nitro Strive Nitric Oxide

Leave a Reply

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