I am trying to add a list of IP addresses (using a variable) to a security rule during deployment. Azure CLI isn't accepting the values as a variable, however the same value works if added manually.
Has anyone come across a similar issue? or know of another automated way around this.
This doesn't work
$ipWhitelist = '11.11.11.11 22.22.22.22' (I have tried many combinations i.e. space or comma between the addresses etc.)
az network nsg rule update --resource-group myRG --nsg-name myNGS -n MyRule --source-address-prefixes $ipWhitelist
Security rule XXXXXXXXX has invalid Address prefix. Value provided: 11.11.11.11 22.22.22.22
Security Rule XXXXXXXXX has invalid Address prefix. Value provided: 11.11.11.11,22.22.22.22
Variables work with single IP address
$ipWhitelist = '11.11.11.11'
So issues seems to be with variables with multiple ip addresses.
However this works fine
az network nsg rule update --resource-group myRG --nsg-name myNGS -n MyRule --source-address-prefixes 11.11.11.11 22.22.22.22
You could run the following Comma-separated string list on PowerShell.
$ipWhitelist = "11.11.11.11", "22.22.22.22"
az network nsg rule update --resource-group nancytest --nsg-name win-nsg -n NRMS-Rule-103 --source-address-prefixes $ipWhitelist