Open bennoschoonraad opened 1 year ago
Most likely not a bicep issue. Are you able to open a support case for this and have it routed to the CDN team?
I also encountered this issue. I needed to update the hostname on my origin. In my Bicep I also explicitly set the hostname
and originHostHeader
properties to the same value.
When I looked at the endpoint in the Azure Portal, only the origin host header value had changed. The hostname was still set to the old value. I ended up deleting the resource manually and deploying again, which created it just fine.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @t-bzhan, @gxue. Please see https://aka.ms/biceptypesinfo for troubleshooting help.
We have faced the same issue.
To have properly working bicep template for cdn endpoint, that works correctly for endpoint creation and update you need to have 3 resources:
1) cdn profile 2) cdn endpoint 3) cdn endpoint origin - without this update of the host name will not work.
Here is sample of working template:
@description('Location for all resources.')
param location string = 'global'
resource profile 'Microsoft.Cdn/profiles@2024-02-01' = {
name: 'xxxxx-cdnprofile'
location: location
properties: {}
sku: {
name: 'Standard_Microsoft'
}
}
resource endpoint 'Microsoft.Cdn/profiles/endpoints@2024-02-01' = {
parent: profile
location: location
name: 'xxxxx-cdnendpoint'
properties: {
originHostHeader: 'newhostname'
isHttpAllowed: false
isHttpsAllowed: true
queryStringCachingBehavior: 'UseQueryString'
contentTypesToCompress: [
'text/plain'
'text/html'
'text/css'
'text/javascript'
'application/x-javascript'
'application/javascript'
'application/json'
]
isCompressionEnabled: true
origins: [
{
name: 'origin1'
properties: {
hostName: 'newhostname'
originHostHeader: 'newhostname'
}
}
]
deliveryPolicy: null
}
}
resource origin 'Microsoft.Cdn/profiles/endpoints/origins@2024-02-01' = {
name: 'origin1'
parent: endpoint
properties: {
hostName: 'newhostname'
}
}
Bicep version Using
AzureCLI@2
and the command:az deployment
Describe the bug When updating an existing Microsoft.Cdn profile with a
.bicep
file, there seems to be an issue replacing the existinghostName
with the newhostName
.The
originHostHeader
gets updated as expected, however, it seems that thehostName
failed to update, and remained as the previously configuredhostName
To Reproduce Steps to reproduce the behavior:
hostName
andoriginHostHeader
) existshostName
andoriginHostHeader
have updated to the newly configured values.Additional context