- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
资源类型
Microsoft.Cdn/profiles/originGroups/origins
API版本
2021-06-01
我正在尝试使用自定义域名为多个 Azure 应用服务部署 Azure Front Door。我能够部署多个自定义域名,并将它们与自己的路由关联起来,类似于他们自己的 WAF 策略。但是,我正在努力创建多个源组并添加它们自己的源。
每当我尝试引用父资源 frontDoorOriginGroup 时,都会收到如下错误
'模板资源'[format('{0}/{1}/{2}',parameters('frontDoorName'),format('{0}-origins',replace(parameters('origins') [范围(0,长度(参数('origins')))[参数('origins')[copyIndex()]]],'.','-')),替换(参数('origins')[copyIndex ()]、'.'、''))]' 在第 1 行和第 5424 列无效:无法评估命名属性或非整数索引 'web-app-name.azurewebsites.net'数组值...
我的二头肌代码
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'
}
}]
有没有办法将子资源作为数组引用到父资源?我读了这个文档Set name and type for child resources in Bicep不适合我,或者我做错了什么?请协助。谢谢!
最佳答案
因此,如果有人遇到类似问题,请进行如下更改以使其正常工作
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 i in range(0, length(origins)): {
name: frontDoorOriginGroup[i].name
parent: frontDoorOriginGroup[i]
properties: {
hostName: origins[i]
httpPort: 80
httpsPort: 443
originHostHeader: origins[i]
priority: 1
weight: 50
enabledState: 'Enabled'
}
}]
关于 azure 二头肌 : Cannot reference a child resource to a parent resource as an array,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76203872/
例如,在使用 Azure Function 和 bicep 时,该函数需要一个应用服务计划,并且该计划需要一个 sku: resource MyHostingPlan 'Microsoft.Web/s
我有一个租户,我们一直在其中添加订阅。我希望循环所有订阅并在每个订阅上运行部署,而无需对订阅 ID/名称列表进行硬编码。在二头肌模板中,是否可以以某种方式获取租户/管理组中所有订阅的列表? 上下文:我
我在尝试使用 Bicep(我才真正开始学习)将简单的 Azure BlobFS 链接服务部署到 ADF 中时遇到了很大的困难。 到目前为止我的二头肌是: //---Data Factory resou
我正在使用 Bicep 脚本在 Mcirosoft Azure 中创建资源。 我已经定义了一个带有所有资源都相同的通用标签的变量。但是现在,当将此变量分配给资源时,我想添加更多仅适用于该资源的标签。
我在尝试使用 Bicep(我才真正开始学习)将简单的 Azure BlobFS 链接服务部署到 ADF 中时遇到了很大的困难。 到目前为止我的二头肌是: //---Data Factory resou
我正在使用 Bicep 脚本在 Mcirosoft Azure 中创建资源。 我已经定义了一个带有所有资源都相同的通用标签的变量。但是现在,当将此变量分配给资源时,我想添加更多仅适用于该资源的标签。
我有 Terraform 背景和 AWS。现在我正在将 Bicep 与 Azure 结合使用,所以请耐心等待:) 在 Terraform 中,我们使用 random_password 创建随 secr
我有一个具有命名值资源的模块,另一个具有 api 和操作资源的模块。然后我有一个二头肌文件(main.bicep),它将调用这两个文件。缩短版本(只是为了更容易解释): namedValue 模块:
我有一个参数,它是一个对象数组。对象中的元素之一(“peers”)是另一个对象数组。我想动态提取对等数组并联合/连接它们并保留“vnetid”作为引用。 param vnets array = [
我正在创建一个像这样的二头肌模块: param permission object var keys = [for key in permission.keys: key] var secretes=
我在二头肌脚本中定义了多个应用服务。对于每一个,我都使用配置资源来定义配置。 resource appSettings1 'Microsoft.Web/sites/config@2022-03-01'
我正在尝试使用 Bicep 部署 Azure 策略分配。 resource policy_assignment 'Microsoft.Authorization/policyAssignments@2
我遇到以下问题:我想部署存储帐户,但前提是该帐户不存在。 我使用 az cli 部署脚本检查是否存在: resource checkStorageAccountExistence 'Microsoft
我在二头肌脚本中定义了多个应用服务。对于每一个,我都使用配置资源来定义配置。 resource appSettings1 'Microsoft.Web/sites/config@2022-03-01'
我正在尝试使用 Bicep 部署 Azure 策略分配。 resource policy_assignment 'Microsoft.Authorization/policyAssignments@2
我遇到以下问题:我想部署存储帐户,但前提是该帐户不存在。 我使用 az cli 部署脚本检查是否存在: resource checkStorageAccountExistence 'Microsoft
我是 bicep 新手,一直在努力实现 Bicep 脚本来部署具有许多主题和订阅的 Azure 服务总线。 我添加的每个主题都有可变数量的订阅(例如,通知主题可能有 3 个订阅,但分析主题可能有 2
我正在通过 bicep 部署 azure 更新管理服务的计划。我的代码如下: param parSchedules array = [ { name: 'mysched1' mon
我是 bicep 新手,一直在努力实现 Bicep 脚本来部署具有许多主题和订阅的 Azure 服务总线。 我添加的每个主题都有可变数量的订阅(例如,通知主题可能有 3 个订阅,但分析主题可能有 2
我正在通过 bicep 部署 azure 更新管理服务的计划。我的代码如下: param parSchedules array = [ { name: 'mysched1' mon
我是一名优秀的程序员,十分优秀!