> ## Content Index
> Fetch the complete content index at: https://www.techielass.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Clean Up Azure Resource Groups with PowerShell
- URL: https://www.techielass.com/clean-up-azure-resource-groups-with-powershell/
- Published: 2017-03-24T06:00:00.000Z
- Updated: 2021-03-13T11:00:38.000Z
- Author: Sarah Lean
- Tags: Azure

I have an Azure subscription that I use for test/dev purposes and it was starting to get a little crowded the other day with various labs that I had spun up for a purpose and never removed. So I had a wee spring clean using some handy PowerShell commands. I covered some basic commands on how to connect to your Azure subscription via PowerShell within my "[Connecting to Azure with PowerShell and controlling your VMs](https://www.techielass.com/connecting-to-azure-with-powershell)" blog post.

### Connect to Azure with PowerShell

To log into your Azure account with PowerShell you need to issue the following command, once ran this will launch a pop up box asking you for your credentials:

```
Login-AzureRMAccount

```

### List your Azure Resource Groups

As I wanted to get rid of every object within my Resource Groups, I issued a PowerShell command that would display which resources I had within my subscription:

```
Find-AzureRmResource | Select-Object ResourceGroupName
``` This command listed all the names of the Resource Groups I had but it listed them several times, once for each resource in that group.  It made the output a bit long winded and cluttered. I then issued the command: 

```

Find-AzureRmResource | Select-Object ResourceGroupName -Unique

```
This shortened the list so that it only showed the name of the Resource Group once, must easier to read! 

### Remove Azure Resource Groups

Now in order to get rid of the Resource Groups I used the following command: 

```

Remove-AzureRMResourceGroup -Name WSUSDEV -Force

```
The above command removed all the resources within my Resource Group called "WSUSDEV" and didn't prompt me to check I wanted to carry out the action.
```