azureazure-cliazure-static-web-appcustom-domain

How do I add a custom domain with 'on other DNS' option to a static web app with Azure CLi


I would like to add a custom domain that is managed by AWS to my Azure Static Web App. Microsoft documentation shows how to add one if the DNS is managed by Azure itself. Sadly, I cannot find anything for my use case. To be more clear, the function I'd like to use with Azure command line is shown in this picture.

I have tried az staticwebapp hostname set --name FOO --hostname BAR.com which doesn't work.


Solution

  • I suppose you have already configured CNAME/TXT/ALIAS record with your DNS provider.

    You may use --no-wait option to not wait for validation or use --validation-method "dns-txt-token" or "cname-delegation"

    I would also suggest to verify your CNAME record, as often domain field must be filled with subdomain, not regular/naked domain.

    Please also check if you are using the latest version of az cli. You may check version using command az version

    https://learn.microsoft.com/en-us/cli/azure/staticwebapp/hostname?view=azure-cli-latest#az-staticwebapp-hostname-set-examples