Last active
December 1, 2019 23:43
-
-
Save venura9/ddaf58c307ff3efd7b2ebce3e3706bdb to your computer and use it in GitHub Desktop.
Get all the resources in a subscription to CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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