#!/bin/zsh

if [ ! -e groupnames.json ]; then
    echo "create_dns_entries.sh requires groupnames.json in the current dir."
fi

for ip name in $(jq -r '. | to_entries | .[] | "\(.key) \(.value)"' groupnames.json);
do
    echo "Adding record for $name ($ip)"
    PYTHONWARNINGS="ignore" az network dns record-set A add-record -g webtech -z webtech-uva.nl -n $name -a $ip
done
