You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
743 B

#!/usr/bin/env bash
# Remove the TXT DNS record with azure-cli
fulldomain="${1}"
if [[ -z "$AZURE_RESOURCE_GROUP" ]]; then
echo "AZURE_RESOURCE_GROUP is not set. Unable to set TXT records."
exit 2
fi
if [[ -z "$AZURE_ZONE_ID" ]]; then
echo "AZURE_ZONE_ID is not set. Unable to set TXT records."
exit 2
fi
if [[ -z "$AZURE_SUBSCRIPTION_ID" ]]; then
echo "AZURE_SUBSCRIPTION_ID is not set. Unable to set TXT records."
exit 2
fi
az account set --subscription "$AZURE_SUBSCRIPTION_ID"
recordset="_acme-challenge.${fulldomain/.$AZURE_ZONE_ID/}"
[[ "$recordset" == "_acme-challenge.$fulldomain" ]] && recordset="_acme-challenge"
az network dns record-set txt delete --yes -g "$AZURE_RESOURCE_GROUP" -z "$AZURE_ZONE_ID" -n "$recordset"