Resource Type
Microsoft.Cdn/profiles/originGroups/origins
Api Version
2021-06-01
I'm trying to deploy Azure Front Door for multiple Azure App Services with custom domain names. I am able to deploy multiple custom domain names and associate them with their own route and similar to their own WAF policy. However, I am struggling with creating multiples Origin Groups and adding their own origin.
Whenever I try to reference a parent resource frontDoorOriginGroup I get an error as below
'The template resource '[format('{0}/{1}/{2}', parameters('frontDoorName'), format('{0}-origins', replace(parameters('origins')[range(0, length(parameters('origins')))[parameters('origins')[copyIndex()]]], '.', '-')), replace(parameters('origins')[copyIndex()], '.', ''))]' at line '1' and column '5424' is not valid: Unable to evaluate named property or non-integer index 'web-app-name.azurewebsites.net' on an array value...
My Bicep code
resource frontDoorOriginGroup 'Microsoft.Cdn/profiles/originGroups@2021-06-01' = [for i in range(0, length(origins)): {
name: replace(origins[i], '.', '-')
parent: frontDoorProfile
properties: {
loadBalancingSettings: {
sampleSize: 4
successfulSamplesRequired: 2
}
healthProbeSettings: {
probePath: healthCheckPath
probeRequestType: 'GET'
probeProtocol: 'Https'
probeIntervalInSeconds: 120
}
}
}]
resource frontDoorOrigin 'Microsoft.Cdn/profiles/originGroups/origins@2021-06-01' = [for origin in origins: {
name: frontDoorOriginGroup[origin].name
parent: frontDoorOriginGroup[origin]
properties: {
hostName: '${origin}'
httpPort: 80
httpsPort: 443
originHostHeader: '${origin}'
priority: 1
weight: 50
enabledState: 'Enabled'
}
}]
Is there a way to reference a child resource to a parent resource as an array? I read this documentation Set name and type for child resources in Bicep didn't work for me, or do I do something wrong? Please, assist. Thanks!