I am trying to pass a parameter with an IP address prefix (say, 10.0.0.0/24) in an ARM template to deploy a VNET
In the ARM template, I would like to replace 10.0.0.0/24 with 10.0.0.123 and assign it to a NIC which I would like to use later to create a VM.
I was hoping is there any way to achieve this using an ARM template?
Well, there is no pretty way of doing this, easiest one:
"var1": "[first(split(parameters('addressPrefix'), '/'))]",
"var2": "[substring(variables('var1'), 0, sub(length(variables('var1'), 1)))]"
"var3": "[concat(variables('var2'), 'ipgoeshere')]"
alternatively you can just chop out last 4 characters and concat ip address, or split and concat parts into an ip address:
"var1": "[first(split(parameters('addressPrefix'), '/'))]",
"var2": "[concat(variables('var1')[0], '.', variables('var1')[1], '.', variables('var1')[2], '.ipgoeshere')]"