Reputation: 3606
I have public static IP address with name 'VPNPublicIP' in resource group. How to reference this address in below ARM template ? I don't want to this static to change
"resources": [
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('WebPublicIPName')]",
"location": "[variables('location')]",
"properties": {
"privateIPAllocationMethod": "Static",
"publicIPAddress": "VPNPublicIP",
}
}
}
I believe the one above is not correct, please advice
Upvotes: 1
Views: 1052
Reputation: 31454
You can reference the existing public IP to another resource with its resource Id:
"publicIPAddress": {
"id":"[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
Upvotes: 2
Reputation: 72191
You dont have to reference it in the same resource, you just need to set its privateIPAllocationMethod
property to static and thats it. it will be created as a static ip address.
{
"apiVersion": "[variables('apiVersion')]",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('WebPublicIPName')]",
"location": "[variables('location')]",
"properties": {
"privateIPAllocationMethod": "Static"
}
}
if you want to attach it to something you can use the resourceId()
function as the other answer suggests.
Upvotes: 1