List all your Azure Resources

Ok, I know that for most of you out there this article might not be necessary, since I know  for sure (ha, ha) that system administrators always document their on-premise or Azure deployments very accurate :-).

If you are not one of them, or if you look for an easy way to cross-check weather or not your documentation is up-to-date, this article might help you. It comes down to the question: How do you build an Excel sheet of all your Azure resources in a simple way?

The good news is: There is a great PowerShell module for this by Douglas Finke , it’s called „ImportExcel“ and you can find it on the Powershell Gallery. All you need to do is enter this line in an elevated PowerShell session:

Install-Module -Name ImportExcel

Build your list

We only need one cmdlet, Export-Excel. I can only recommend to have a look at all the other cmdlets the module provides, it’s absolutely worth it!

Get-AzResource |Export-Excel -Path c:\temp\ralftest.xlsx -WorksheetName "resources" -AutoSize -BoldTopRow

Note: I’m using the new „-Az“-format, see here. If you didn’t update your Azure module so far, you can use the Get-AzureRmResource, or (preferrably) update the module.

You’ll get an Excel file with all your resources, line by line. Take your time to play around with the other options the cmdlet provides, like -Title.

Filtering

Depending on your number of resources this can take some time. Of course feel free to filter your output before piping it to the cmdlet, like for tags:

Get-AzResource -TagName "purpose" -TagValue "test" | Export-Excel ...

or for a specific resource group:

Get-AzResource -ResourceGroupName rg-docker01 | Export-Excel ...

or for whatever you want, like regions:

Get-AzResource | ? {$_.Location -eq "northeurope"} | Export-Excel ...

You can of course also filter the attributes you want to show up in your sheet:

Get-AzResource | select Name,Location | Export-Excel ...

BTW: Make sure you use a new name for each Excel file, the cmdlet acts a little bit strange when writing to an already existing file.

Nice? Definitely!

Ein Kommentar zu „List all your Azure Resources

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google Foto

Du kommentierst mit Deinem Google-Konto. Abmelden /  Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s