Skip to content

Instantly share code, notes, and snippets.

@venura9
Last active December 1, 2019 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venura9/ddaf58c307ff3efd7b2ebce3e3706bdb to your computer and use it in GitHub Desktop.
Save venura9/ddaf58c307ff3efd7b2ebce3e3706bdb to your computer and use it in GitHub Desktop.
Get all the resources in a subscription to CSV
#connect to the teanant
Connect-AzAccount -t 'tenant_id_guid'
#get the guids of the subscriptions
Get-AzSubscription
#use one of the guids from the previous command
Select-AzSubscription -SubscriptionId 'subscriptio_id_guid' -TenantId 'tenant_id_guid'
#export the everything as CSV
Get-AzResource | Export-Csv -Path ~/Desktop/azure-inventory.csv
#export selected columns as CSV
Get-AzResource | Select-Object Name, ResourceGroupName | Export-Csv -Path ~/Desktop/azure-inventory-1.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment