Quickstart: Create a public IP address using a Resource Manager template
This article shows how to create a public IP address resource within a Resource Manager template.
For more information on resources this public IP can be associated to and the difference between the basic and standard SKUs, see Public IP addresses.
Prerequisites
- If you don't have an Azure subscription, create a trial subscription before you begin.
- A resource group in your Azure subscription.
- An Azure Resource Manager template for the public IP sections.
Create standard public IP without zones
In this section, you create a non-zonal IP address.
The code in this section creates a standard no-zone public IPv4 address named myStandardPublicIP.
To create an IPv6 address, modify the publicIPAddressVersion parameter to IPv6.
Template section to add:
{
"apiVersion": "2020-08-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "myStandardPublicIP-nozone",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard"
},
"properties": {
"publicIPAllocationMethod": "Static",
"publicIPAddressVersion": "IPv4"
}
Important
For API versions older than 2020-08-01, not specifying a zone parameter for a Standard SKU will create a zone-redundant IP address.
Create a basic public IP
In this section, you create a basic IP.
The code in this section creates a basic public IPv4 address named myBasicPublicIP.
To create an IPv6 address, modify the publicIPAddressVersion parameter to IPv6.
Template section to add:
{
"apiVersion": "2020-08-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "myBasicPublicIP",
"location": "[resourceGroup().location]",
"sku": {
"name": "Basic"
},
"properties": {
"publicIPAllocationMethod": "Static",
"publicIPAddressVersion": "IPv4"
}
If it's acceptable for the IP address to change over time, publicIPAllocationMethod IP assignment can be selected by changing the AllocationMethod to Dynamic.
Note
A basic IPv6 address must always be 'Dynamic'.
Additional information
For more information on the public IP properties listed in this article, see Manage public IP addresses.
Next steps
- Associate a public IP address to a Virtual Machine
- Learn more about public IP addresses in Azure.
- Learn more about all public IP address settings.