DEV Community

Cover image for using jq to handle az graph output
Antoine
Antoine

Posted on

using jq to handle az graph output

Photo by Raphael Renter on Unsplash

I had to improve the az graph query due to a change in tsv format provided by az graph to a csv produced by jq.

Reminder:

IFS_old=$IFS;
IFS=$'\n';
az graph query -q "where type =~ 'Microsoft.Web/sites' and kind=~'$type' | project name, resourceGroup" | jq '.data[] | [.name, .resourceGroup] | @csv' -r | for i in ` awk -F ',' '{print " --name " $1 " --resource-group " $2 }' ` ; do eval "az webapp config appsettings set $i --settings WEBSITE_RUN_FROM_PACKAGE='$PackageLink' " ;done;
IFS=$IFS_old;
Enter fullscreen mode Exit fullscreen mode

Useful Links:

Hope this helps

Top comments (0)