I am trying to pass some of the cidr address prefixes through an entered parameter. For example, I need to pass the following property for my network security group security rule:
"sourceAddressPrefixes": [
"y.y.y.y/32",
"x.x.0.0/16"
]
The y.y.y.y/32
address range is what I'm trying to parameterize.
The entry in the "parameters:"
section:
"remoteOfficeIpCidr": {
"defaultValue": "",
"type": "String"
}
I have tried to pass the property as a list of address ranges without enclosing them in double quotes (equivalent to using ''
below). Template syntax validates but the deployment fails. So, I am trying to enclose each address range in double quotes (The deployment also fails if I pass the addresses enclosed by single quotes).
I have tried escaping the quotes:
"sourceAddressPrefixes": [
"[concat(if(not(empty(parameters('remoteOfficeIpCidr'))), concat('\"',parameters('remoteOfficeIpCidr'),'\",'),''), '\"x.x.0.0./16\"')]"
]
More generally, I iterated the following:
"sourceAddressPrefixes": [
"[concat(if(not(empty(parameters('remoteOfficeIpCidr'))), concat(<myQuotingSyntax>,parameters('remoteOfficeIpCidr'),<myQuotingSyntax>,','),''), concat('\"','x.x.0.0./16',<myQuotingSyntax>))]"
]
I have tried to get the template to work using the following strings in each instance of <myQuotingSyntax>
:
- '' (empty string - two single quotes)
- '\"' (escaped double quote enclosed by single quotes)
- '"' (double quote enclosed by single quotes)
- '""' (repeated double quotes enclosed by single quotes)
- ''' (triple single quotes)
(<backTick> (`) would not render properly here)
- <backTick>" (<backTick> followed by double quote)
- <backTick>"<backTick> (double quote enclosed by <backTick>)
- "
- %22x
Some of these pass template syntax validation but fail during the deploy. But none are successful.
I'm out of ideas. I welcome any and all suggestions.