Home > Net >  Azure CLI(Export azure resource to csv)
Azure CLI(Export azure resource to csv)

Time:07-13

I’m new to azure, Can anyone provide the solution for the following scenario?

How to export the azure resources to csv file, Using azure CLI?

Kindly share the Azure CLI commands.

Thanks, Chandru

CodePudding user response:

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 to csv:

az resource list --out tsv | sed 's/\t/,/g'

or with PowerShell as described here.

CodePudding user response:

You can use the below comdlet in azure powershell to export resources in csv file :

Get-AzResource | Export-Csv -Path "C:\NewFolder\test.csv"

enter image description here

Output:

enter image description here

References taken from:

  • Related