英文:
Azure bicep store App Ip in string parameter
问题
我想将应用站点的出站 IP 存储在一个字符串参数中,以便稍后将 IP 拆分为数组使用,但我收到了“此符号无法在此引用。只有其他参数可以在参数默认值中引用”的消息,我不知道该如何继续。
有人能帮助我吗?以下是我的代码:
resource sitewww 'Microsoft.Web/sites@2022-03-01' = {
name: 'sitewwwname'
location: 'westeurope'
}
param variable string = sitewww.properties.outboundIpAddresses
param allowedIpAddresses array = split(variable, ',')
非常感谢!
英文:
I would like to store the outbound ip of an App site in a string parameter, so I could use it later to split the ips into an array, but I get the "this symbol cannot be referenced here. only other parameters can be referenced in parameter default values" message and I do not how to proceed
Can anyone help me? Here is my code:
resource sitewww 'Microsoft.Web/sites@2022-03-01' = {
name: 'sitewwwname'
location: 'westeurope'
}
param variable string = sitewww.properties.outboundIpAddresses
param allowedIpAddresses array = split(variable,',')
Thank you very much!
答案1
得分: 0
你希望在这里使用变量,而不是参数。
所以在你的资源下面的参数声明将会变成变量。
所以你的 Bicep 代码会变成:
resource sitewww 'Microsoft.Web/sites@2022-03-01' = {
name: 'sitewwwname'
location: 'westeurope'
}
var variable = sitewww.properties.outboundIpAddresses
var allowedIpAddresses = split(variable, ',')
英文:
You want to be using a variables here not a parameters.
So the param declarations below your resource would change to var
So your bicep above would be
resource sitewww 'Microsoft.Web/sites@2022-03-01' = {
name: 'sitewwwname'
location: 'westeurope'
}
var variable = sitewww.properties.outboundIpAddresses
var allowedIpAddresses = split(variable,',')
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论