azure-swa-custom-domains

Diagnose and configure Azure Static Web Apps custom domains, DNS records, and Terraform bindings.

2|Updated Aug 2, 2026
One-click install
npx skills add https://github.com/Arasz/ai-raccoon --skill azure-swa-custom-domains-arasz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: azure-swa-custom-domains
Source: https://github.com/Arasz/ai-raccoon/tree/main/.ai-badger/skills/learned/devops/azure-swa-custom-domains
Command: npx skills add https://github.com/Arasz/ai-raccoon --skill azure-swa-custom-domains-arasz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Custom domains on Azure Static Web Apps fail in non-obvious ways: the binding shows Ready but DNS still points to the old host, apex domains reject CNAME records, SVCB records silently do nothing, and a green CI deploy can hide a missing deployment token. This Skill captures the diagnostic steps and fixes for these failures. ## Core Features & Use Cases - DNS diagnosis: Distinguish validation records (TXT _dnsauth) from routing records (A/ALIAS/CNAME), verify with dig and DoH queries, and detect apex constraints like MX records blocking root CNAMEs. - Terraform management: Import portal-created azurerm_static_web_app_custom_domain bindings safely, handle the provider read gap with lifecycle { ignore_changes = [validation_type] }, and fix mocked-plan test failures. - Deployment troubleshooting: Identify when the SWA placeholder page means no deployment ever happened (builds API WaitingForDeployment, skipped deploy steps exiting 0 via SKIP_DEPLOY_ON_MISSING_SECRETS). - Use Case: A custom domain shows the SWA placeholder despite a Ready binding — trace the evidence chain from DNS to the builds API to the GitHub Actions deploy log to find the missing token. ## Quick Start Diagnose why my Azure Static Web Apps custom domain shows the placeholder page even though the binding status is Ready.

Frequently Asked Questions about azure-swa-custom-domains

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a custom domain to Azure Static Web Apps?

Add the domain via portal, CLI, or Terraform, then create two record sets: a validation record (TXT `_dnsauth.<domain>` for apex, or CNAME to the SWA hostname) and a routing record (A, ALIAS, or CNAME). The binding must reach Ready status before traffic flows.

How do I point an apex domain to Azure Static Web Apps?

Apex domains require TXT dns-txt-token validation since CNAME is impossible at the root. Route traffic with an ALIAS record or a plain A record pointing to the SWA's stableInboundIP, retrieved via the ARM REST API since `az staticwebapp show` does not expose it.

Why does my SWA custom domain show the placeholder page?

A placeholder on both the custom domain and the default host means the SWA never received a deployment, not a DNS problem. Check the builds API for `WaitingForDeployment` status and inspect deploy step logs for a missing deployment token masked by `SKIP_DEPLOY_ON_MISSING_SECRETS`.

Can I use a CNAME at the root domain with MX records?

No. RFC 1034 forbids other records coexisting with a CNAME, so a root CNAME breaks MX-based email. Check `dig +short <domain> MX` first; if mail records exist, use an A record to the stableInboundIP or an ALIAS record instead.

Why does Terraform force replacement of my SWA custom domain on every apply?

The Azure API does not return the validation method on read, so an imported binding has `validation_type = null` in state and the config value plans a forced replacement. Add `lifecycle { ignore_changes = [validation_type] }` to stop the churn.

Why does staticwebapp.config.json reject my exclude path with multiple wildcards?

Azure SWA does not support brace expansion like `*.{html,css,js}`; the validator treats it as multiple wildcards despite the misleading error. Expand the pattern into individual entries such as `*.html`, `*.css`, and `*.js`.