Search code examples
azureazure-devopsazure-bicep

Azure bicep store App Ip in string parameter


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!


Solution

  • 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,',')