I am trying to set up a custom domain for Azure front door. This is what I am doing:
- I have an Azure DNS setup (
sofad.com) for the domain (and already configured) - I have an instance of Azure Front Door (
sofad-fd) created. I want to route all trafic coming to the Azure DNS for the apex domainsofad.comto be routed to Azure Front Door.
In the portal I am able to manually create an A (alias) record and select the Azure front door. But I want to do this via Azure cli running in an Azure DevOps pipeline.
I am running in two issues:
- The Azure CLI cannot find the Front Door
#1) ADDING A (ALIAS) TO AZUR DNS
echo "Retrieving Resource ID for Front Door: $FRONT_DOOR_NAME in resource group: $RESOURCE_GROUP..."
FRONT_DOOR_RESOURCE_ID=$(az network front-door show \
--resource-group "$RESOURCE_GROUP" \
--name "$FRONT_DOOR_NAME" \
--query "id" -o tsv)
# Step 2: Check if Resource ID was retrieved successfully
if [ -z "$FRONT_DOOR_RESOURCE_ID" ]; then
echo "Error: Could not retrieve Resource ID for Front Door: $FRONT_DOOR_NAME in resource group: $RESOURCE_GROUP."
exit 1
fi
echo "Front Door Resource ID: $FRONT_DOOR_RESOURCE_ID"
az network dns record-set a create \
--resource-group $RESOURCE_GROUP \
--zone-name $APEX_DOMAIN \
--name "@" \
--target-resource-id $FRONT_DOOR_RESOURCE_ID \
--ttl 3600
The command az network front-door show returns null
and 2) Even if I hardcode the resource id like this:
#1) ADDING A (ALIAS) TO AZURE DNS with hardcoded --target-resource-id
az network dns record-set a create \
--resource-group $RESOURCE_GROUP \
--zone-name $APEX_DOMAIN \
--name "@" \
--target-resource-id /subscriptions/<some subs id>/resourceGroups/dev-app1-rg/providers/Microsoft.Cdn/profiles/sofad-fd \
--ttl 3600
With resource id that I pick up from the Azuer Portal, the command fails with ERROR: unrecognized arguments: --target-resource-id /subscriptions/...
I am a bit stuck and cannot move forward with my pipeline. Thanks


