[Bicep/ARM] Cannot set custom domain
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I'm trying to create a SWA from scratch using Bicep, and setting custom domains the same way.
My template looks like this for the SWA part:
```bicep
resource staticWebApp 'Microsoft.Web/staticSites@2021-01-15' = {
name: '${appName}-staticwebapp${dashSuffix}'
location: location
sku: {
name: 'Standard'
tier: 'Standard'
}
properties: {
repositoryUrl: 'https://github.com/${githubRepo}'
branch: 'main'
provider: 'GitHub'
repositoryToken: githubToken
buildProperties: {
appLocation: '/'
apiLocation: ''
outputLocation: 'dist/${projectName}'
skipGithubActionWorkflowGeneration: true
githubActionSecretNameOverride: 'AZURE_SWA_TOKEN'
}
stagingEnvironmentPolicy: 'Enabled'
allowConfigFileUpdates: true
userProvidedFunctionApps: [
{
functionAppResourceId: functionApp.id
functionAppRegion: location
}
]
}
dependsOn: [
functionApp
]
resource staticWebAppDomains 'customDomains@2021-01-15' = [for domain in domains: {
name: domain
properties: {
validationMethod: 'dns-txt-token'
}
}]
}
```
I would like to use TXT validation for validating the domain names, as seen here in the template.
I have 2 issues doing that:
- I don't know how to get the generated token code, so I can put in the Azure DNS template. I found nothing related in the docs.
- The Bicep template without the `customDomains` part works fine. But when I add the `customDomains` section, it never returns and seems to get stuck (waiting for the validation to succeed?). When I break out of the deployment (with CRTL+C) as it's waiting forever, get an error when I'm trying to redeploy because the previous deployment never ended:
```
{"error":{"code":"DeploymentActive","message":"Unable to edit or replace deployment 'poc': previous deployment from '10/12/2021 12:33:34 PM' is still active (expiration time is '10/19/2021 12:28:14 PM'). Please see https://aka.ms/arm-deploy for usage details."}}
```
I have to cancel the deployment manually otherwise it gets stuck for days.
Note that I'm deploying the bicep template with `az deployment group create`.
**Expected behavior**
Adding `customDomains` resources to my SWA Bicep template should work without getting stuck in the process, and I should be able to retrieve the generated validation codes to use then in the Azure DNS part of the Bicep template.
**Additional info:**
I should mention that the custom domain are correctly set, as I can see them in the Azure portal, in the custom domains section of the deployed SWA, waiting on "validating" message.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.