Skip to content

Instantly share code, notes, and snippets.

@bfleming-ciena
Created February 7, 2020 03:53
Show Gist options
  • Save bfleming-ciena/f7aea9029edebe44de221628023de33c to your computer and use it in GitHub Desktop.
Save bfleming-ciena/f7aea9029edebe44de221628023de33c to your computer and use it in GitHub Desktop.
Dump all azure resources
# Dumps all resources in all subscriptions and pulls fields related to the resource and most
# importantly, the tags currently applied.
#
# I was using this to import into an excel spreadsheet, which we then reviewed and modified the tag values.
# Then I would dump the spreadsheet back to csv and feed it into the python script which would go and
# update the tags.
echo "id,location,it_Environment,it_App,it_Role,it_Owner,name,resource group,kind,type,tags"
for i in $(az account list -o tsv|cut -f2); do
az resource list --subscription="$i" | jq -r '.[] | [.id,.location,"","","","",.name,.resourceGroup,.kind,.type,(.tags | tostring)] | @csv'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment