| title | Quickstart: Create a public IP - Azure CLI |
|---|---|
| titleSuffix | Azure Virtual Network |
| description | Learn how to create a public IP address using the Azure CLI |
| services | virtual-network |
| author | mbender-ms |
| ms.author | mbender |
| ms.service | azure-virtual-network |
| ms.topic | quickstart |
| ms.date | 11/05/2025 |
| ms.custom | mode-api, devx-track-azurecli |
| ms.devlang | azurecli |
In this quickstart, you learn how to create an Azure public IP address. Public IP addresses in Azure are used for public connections to Azure resources. Two tiers of public IP addresses are available: regional, and global. The routing preference of a public IP address is set when created. Internet routing and Microsoft Network routing are the available choices.
:::image type="content" source="./media/create-public-ip-portal/public-ip-example-resources.png" alt-text="Diagram of an example use of a public IP address. A public IP address is assigned to a load balancer.":::
[!INCLUDE quickstarts-free-trial-note]
[!INCLUDE azure-cli-prepare-your-environment.md]
- This tutorial requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
An Azure resource group is a logical container into which Azure resources are deployed and managed.
Create a resource group with az group create named QuickStartCreateIP-rg in the westus2 location.
az group create \
--name QuickStartCreateIP-rg \
--location westus2
In this section, you learn how to create a standard zone-redundant public IP address.
Note
Standard SKU public IP is recommended for production workloads. For more information about SKUs, see Public IP addresses.
The following command works for API version 2020-08-01 or later. For more information about the API version currently being used, see Resource Providers and Types.
Use az network public-ip create to create a standard zone-redundant public IPv4 address named myStandardPublicIP in QuickStartCreateIP-rg.
To create an IPv6 address, modify the --version parameter to IPv6.
az network public-ip create \
--resource-group QuickStartCreateIP-rg \
--name myStandardPublicIP \
--version IPv4 \
--sku Standard \
--zone 1 2 3
Important
For versions of the API older than 2020-08-01, execute the command without specifying a --zone parameter to create a zone-redundant IP address.
Note
Standard v2 SKU public IP is required for use of the Standard v2 NAT Gateway with zone-redundancy. For more information about SKUs, see Public IP addresses.
The following command works for API version 2020-08-01 or later. For more information about the API version currently being used, see Resource Providers and Types.
Use az network public-ip create to create a standard v2 zone-redundant public IPv4 address named myStandardPublicIP in QuickStartCreateIP-rg.
To create an IPv6 address, modify the --version parameter to IPv6.
az network public-ip create \
--resource-group QuickStartCreateIP-rg \
--name myStandardPublicIP \
--version IPv4 \
--sku Standardv2 \
--zone 1 2 3
Important
For versions of the API older than 2020-08-01, execute the command without specifying a --zone parameter to create a zone-redundant IP address.
In this section, you learn how to create a zonal public IP address.
To create a standard zonal public IPv4 address in Zone 2 named myStandardPublicIP in QuickStartCreateIP-rg, use the following command.
To create an IPv6 address, modify the --version parameter to IPv6.
az network public-ip create \
--resource-group QuickStartCreateIP-rg \
--name myStandardPublicIP-zonal \
--version IPv4 \
--sku Standard \
--zone 2
Note
The above options for zones are only valid selections in regions with Availability Zones.
Standard SKU static public IPv4 addresses support Routing Preference or the Global Tier feature.
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)?
The command creates a new standard zone-redundant public IPv4 address with a routing preference of type Internet:
az network public-ip create \
--resource-group QuickStartCreateIP-rg \
--name myStandardPublicIP-RP \
--version IPv4 \
--ip-tags 'RoutingPreference=Internet' \
--sku Standard \
--zone 1 2 3
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.
The following command creates a global IPv4 address. This address can be associated with the frontend of a cross-region load balancer.
az network public-ip create \
--resource-group QuickStartCreateIP-rg \
--name myStandardPublicIP-Global \
--version IPv4 \
--tier global \
--sku Standard
Note
Global tier addresses don't support Availability Zones.
If you're not going to continue to use this application, delete the public IP address with the following steps:
-
In the search box at the top of the portal, enter Resource group.
-
In the search results, select Resource groups.
-
Select QuickStartCreateIP-rg.
-
Select Delete resource group.
-
Enter QuickStartCreateIP-rg for TYPE THE RESOURCE GROUP NAME and select Delete.
Advance to the next article to learn how to create a public IP prefix:
[!div class="nextstepaction"] Create public IP prefix using the Azure CLI