-
Notifications
You must be signed in to change notification settings - Fork 258
Description
- Make sure you've installed the latest version using instructions in the wiki
Output from azd version
azd version 0.7.0-beta.1 (commit 9ce7165)
Describe the bug
Everything is working as currently designed, so this is more a bug in the process than the code.
I would like to be able to use azd to deploy a website that has a custom domain attached (on Static Web Apps, App Service, or Container Apps). However, if I specify a domain name in Bicep using 'Microsoft.Web/staticSites/customDomains@2022-03-01' that has not yet been verified, then I get an error during the provision stage. I cannot verify a domain name until I know the website endpoint, however, since the DNS record is a CNAME for 'www' with the value of the website endpoint.
This is how I ended up doing it for my personal website, www.pamelafox.org:
- I set up the infra with domainName as a parameter defaulting to empty string, and only conditionally create the custom domain if the parameter is non-empty:
https://github.com/pamelafox/pamelafox-site/blob/main/infra/swa.bicep#L24 - I then run
azd upwith domainName still empty in main.parameters.json - When I see the deployed endpoint URI, I go to my registrar and add a CNAME of www->endpoint
and wait a few minutes - I set domainName in main.parameters.json and re-deploy.
That seemed to work, but it's possible that I also intervened in the Portal in between those steps.
Maybe there'd be a more straightforward approach if I used Azure's registrar? I already have a registrar I pay for, so I set it up there.