How to export the azure resources to csv file, using azure CLI?
I’m new to azure.
2
To get list of resources you can use:
az resource list
you can add --out switch and use the following formats: json, jsonc, yaml, yamlc, table, tsv but not CSV.
--out
In bash you can try something like this to convert tsv to csv:
tsv
csv
az resource list --out tsv | sed 's/t/,/g'
or with PowerShell as described here.
You can use the below comdlet in azure powershell:
This is an aternative workaround from powershell to export resources in csv file :
Get-AzResource | Export-Csv -Path "C:NewFoldertest.csv"
Output:
References taken from:
https://learn.microsoft.com/en-us/powershell/module/az.resources/get-azresource?view=azps-8.1.0
https://dailydotnettips.com/export-the-list-of-azure-resources-to-excel/
Click here to cancel reply.
2
Answers
To get list of resources you can use:
az resource list
you can add
--out
switch and use the following formats: json, jsonc, yaml, yamlc, table, tsv but not CSV.In bash you can try something like this to convert
tsv
tocsv
:az resource list --out tsv | sed 's/t/,/g'
or with PowerShell as described here.
You can use the below comdlet in azure powershell:
This is an aternative workaround from powershell to export resources in csv file :
Output:
References taken from:
https://learn.microsoft.com/en-us/powershell/module/az.resources/get-azresource?view=azps-8.1.0
https://dailydotnettips.com/export-the-list-of-azure-resources-to-excel/