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;
Useful Links:
- jq CheatSheet
- jq Manual
- this link explains basics on jq and how to loop using jq
- this link describes how to manage output format in CSV
Hope this helps
Top comments (0)