[英]invalid Json error when trying to use the reference function in Azure ARM to create firewall rules based on resource property
I am creating azure firewall DNAT rules as part of an azure devops pipeline.我正在创建 azure 防火墙 DNAT 规则作为 azure devops 管道的一部分。 I dont want to specify the public IP manually, i want to pull this value from the properties of the public nic.
我不想手动指定公共 IP,我想从公共网卡的属性中提取这个值。 This way if we clone the pipeline, or rebuild, we dont have to update the IP address.
这样,如果我们克隆管道或重建管道,就不必更新 IP 地址。
This is just an excerpt from the ARM template.这只是 ARM 模板的摘录。 This first example works.
第一个例子有效。
"destinationAddresses": [
"52.180.91.89"
]
My attempt to replace it is below.我尝试更换它如下。 Please note that the public IP is created in the ARM template so I am not referencing the full path to the resource.
请注意,公共 IP 是在 ARM 模板中创建的,因此我没有引用资源的完整路径。
"destinationAddresses": "[reference(variables('arm_firewall_buildagentip')).ipAddress]"
The error i am receiving is below.我收到的错误如下。 Its returning the correct value, but I am not sure how to format it so it can be accepted in the firewall rule.
它返回正确的值,但我不确定如何格式化它以便它可以在防火墙规则中被接受。
##[error]BadRequest: {
"error": {
"code": "InvalidRequestFormat",
"message": "Cannot parse the request.",
"details": [
{
"code": "InvalidJson",
"message": "Error converting value \"52.180.91.89\" to type 'System.Collections.Generic.List`1[System.String]'. Path 'properties.natRuleCollections[0].properties.rules[1].destinationAddresses', line 1, position 2880."
}
]
}
} undefined
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.