0

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.

  • I suppose you have already configured CNAME/TXT/ALIAS record with your DNS provider. You may use `--no-wait` to not wait for validation or put `--validation-method` "dns-txt-token", "cname-delegation" https://learn.microsoft.com/en-us/cli/azure/staticwebapp/hostname?view=azure-cli-latest#az-staticwebapp-hostname-set-examples – Andriy Bilous Sep 05 '22 at 15:17
  • Yes, I have configured the Azure default URL with AWS under the domain I want it redirected to. I also tried these additional parameters and it continually tells me "ERROR: CNAME Record is invalid". However, when using the Azure UI directly to add the domain it works fine and validates itself. Edit: I haven't tried `--no-wait`. I will try this – Wayne Griffin Sep 05 '22 at 15:23
  • What is your CNAME record? I noticed If you forgetting to add "www" in the domain field, domain field must be filled with subdomain, not regular domain without www. – Andriy Bilous Sep 05 '22 at 15:37
  • There is no 'www' in it no. foobar.com as an example. But when I add it through the UI it doesn't have the 'www' either and it works just fine. – Wayne Griffin Sep 05 '22 at 15:48
  • I have just created custom domain for my Azure Static Web App. Domain provider is domain.com. I used CNAME record. Command: `az staticwebapp hostname set --name FOO --hostname test2.BAR.com` az version - 2.40.0 – Andriy Bilous Sep 06 '22 at 09:06
  • Thank you very much for your help. This worked for some reason even though I tried it previously. Shall we leave the solution here or draw it up as an answer? I'm quite new here so not sure how to close the question this way. – Wayne Griffin Sep 07 '22 at 09:37
  • I will make an answer. Please accept it – Andriy Bilous Sep 07 '22 at 13:30

1 Answers1

0

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

Andriy Bilous
  • 2,337
  • 1
  • 5
  • 16