I'm trying to deploy a Virtual Machine using an ARM Template. The VM needs to have a static IP address. When deploying the template I'm getting an error. I think I'm getting the reference to the public IP address from the network interface wrong but I can't see how I should do this? The error is:
20:13:01 - The deployment 'my-template' failed with error(s). Showing 1 out of 1 error(s).
| Status Message: Cannot parse the request. (Code: InvalidRequestFormat) - Value for reference id is
| missing. Path properties.ipConfigurations[0].properties.publicIPAddress. (Code:MissingJsonReferenceId)
| - Value for reference id is missing. Path properties.networkSecurityGroup.
| (Code:MissingJsonReferenceId) CorrelationId: ab49b076-8888-8888-8888-8888888888
I've defined the IP Address thus:
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2020-04-01",
"name": "[variables('myVmIpName')]",
"location": "[variables('location')]",
"sku": {
"name": "Basic"
},
"properties": {
"ipAddress": "198.51.100.176",
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Static",
"idleTimeoutInMinutes": 4,
"dnsSettings": {
"domainNameLabel": "[variables('myVmDnsName')]",
"fqdn": "[concat(variables('myVmDnsName'), '.', variables('location'), '.cloudapp.azure.com')]"
}
}
},
And the network interface is defined like this:
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2020-04-01",
"name": "[variables('myVmNicName')]",
"location": "[variables('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": "[reference(variables('myVmIpName'))]",
"subnet": "[reference(variables('myVnetName')).subnets[0]]",
"primary": true,
"privateIPAddressVersion": "IPv4"
}
}
],
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"networkSecurityGroup": "[reference(variables('myVmNsgName'))]"
}
}
I've changed some of the definition to protect the innocent, but hopefully it is near enough to show the error.