Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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, see Public IP addresses.
Prerequisites
- If you don't have an Azure subscription, create a free account before you begin.
- A resource group in your Azure subscription.
- An Azure Resource Manager template for the public IP sections.
Create standard SKU public IP
In this section, you create a standard SKU public IP. Public IP addresses can be zone-redundant or zonal.
Zone redundant
The code in this section creates a standard zone-redundant 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",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard"
},
"zones": [
"1",
"2",
"3"
],
"properties": {
"publicIPAllocationMethod": "Static",
"publicIPAddressVersion": "IPv4"
}
Important
For API versions older than 2020-08-01, use the code above without specifying a zone parameter for a Standard SKU to create a zone-redundant IP address.
Note
The above options for zones are only valid selections in regions with Availability Zones.
Zonal
The code in this section creates a standard zonal public IPv4 address named myStandardPublicIP-zonal.
To create a standard zonal public IP address in Zone 2, the "zones" property contains a '2'.
Template section to add:
{
"apiVersion": "2020-08-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "myStandardPublicIP-zonal",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard"
},
"zones": [
"2"
],
"properties": {
"publicIPAllocationMethod": "Static",
"publicIPAddressVersion": "IPv4"
}
Note
The above options for zones are only valid selections in regions with Availability Zones.
Non-zonal
In this section, you create a non-zonal IP address, which is used for regions without availability zones. If this is used in regions with availability zones, a zone-redundant IP address will be created.
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"
}
Routing preference and tier
Standard SKU static public IPv4 addresses support Routing Preference or the Global Tier feature.
Routing preference
By default, the routing preference for public IP addresses is set to Microsoft network, which delivers traffic over Microsoft's global wide area network to the user.
The selection of Internet minimizes travel on Microsoft's network, instead using the transit ISP network to deliver traffic at a cost-optimized rate.
For more information on routing preference, see What is routing preference (preview)?.
To use Internet Routing preference for a standard zone-redundant public IPv4 address, the template section should look similar to:
{
"apiVersion": "2020-08-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "myStandardZRPublicIP-RP",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard"
},
"zones": [
"1",
"2",
"3"
],
"properties": {
"publicIPAllocationMethod": "Static",
"publicIPAddressVersion": "IPv4",
"ipTags": [
{
"ipTagType": "RoutingPreference",
"tag": "Internet"
}
]
}
}
Tier
Public IP addresses are associated with a single region. The Global tier spans an IP address across multiple regions. Global tier is required for the frontends of cross-region load balancers.
For more information, see Cross-region load balancer.
To use a standard global public IPv4 address, the template section should look similar to:
{
"apiVersion": "2020-08-01",
"type": "Microsoft.Network/publicIPAddresses",
"name": "myStandardPublicIP-Global",
"location": "[resourceGroup().location]",
"sku": {
"name": "Standard",
"tier": "Global"
},
"properties": {
"publicIPAllocationMethod": "Static",
"publicIPAddressVersion": "IPv4"
}
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.