EnabledHostNames output from WebApp deployment missing custom hostname
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.4.613
**Describe the bug**
I'm deploying a WebApp with a custom host name and outputting app.properties.enabledHostNames so that a pipeline can use those values to create DNS records. On an initial deployment of the app service the custom host name is missing from the output, but an **az webapp show** lists all of the hostnames, even the missing one. On a re-run of the deployment all the hostnames are present in the output.
**To Reproduce**
```bicep
resource app 'Microsoft.Web/sites@2020-12-01' = {
name: appServiceName
location: location
kind: 'app'
properties: {
virtualNetworkSubnetId: intSubnetId
serverFarmId: asp.id
httpsOnly: false
(....)
}
}
resource hostNameCert 'Microsoft.Web/certificates@2020-12-01' = {
name: custHostName
location: location
properties: {
keyVaultId: kv.id
keyVaultSecretName: certSecretName
serverFarmId: asp.id
}
}
resource apiFriendlyName 'Microsoft.Web/sites/hostNameBindings@2020-12-01' = {
name: '${app.name}/${custHostName}'
properties: {
azureResourceName: app.name
azureResourceType: 'Website'
sslState: 'SniEnabled'
thumbprint: hostNameCert.properties.thumbprint
}
}
output pepip string = pep.properties.customDnsConfigs[0].ipAddresses[0]
output hostnames array = app.properties.enabledHostNames
```
**Additional context**
I was able to work around it by using output from the Private Endpoint.
Contributor guide
Research direction
Start by deploying the provided Bicep resources, including the sites/hostNameBindings resource, and compare app.properties.enabledHostNames on the first run with the result from az webapp show. Re-run the deployment to confirm the hostname then appears. Done means the initial deployment output includes the custom hostname without relying on the Private Endpoint output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100