Public IP Address
Introduction
Section titled “Introduction”Azure Public IP Address is a resource that provides a static or dynamic IP address reachable from the internet. Public IP addresses are assigned to Azure resources such as virtual machines, load balancers, application gateways, VPN gateways, and bastion hosts. They are commonly used when resources need to accept inbound internet connections or require a stable outbound identity. For more information, see Public IP addresses.
LocalStack for Azure provides a local environment for building and testing applications that make use of Public IP Addresses. The supported APIs are available on our API Coverage section, which provides information on the extent of Public IP Address’s integration with LocalStack.
Getting started
Section titled “Getting started”This guide is designed for users new to Public IP Addresses and assumes basic knowledge of the Azure CLI and our azlocal wrapper script.
Launch LocalStack using your preferred method. For more information, see Introduction to LocalStack for Azure. Once the container is running, enable Azure CLI interception by running:
azlocal start-interceptionThis command points the az CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API.
To revert this configuration, run:
azlocal stop-interceptionThis reconfigures the az CLI to send commands to the official Azure management REST API.
Create a resource group
Section titled “Create a resource group”Create a resource group to hold all resources created in this guide:
az group create \ --name rg-pip-demo \ --location westeurope{ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo", "location": "westeurope", "managedBy": null, "name": "rg-pip-demo", "properties": { "provisioningState": "Succeeded" }, "tags": null, "type": "Microsoft.Resources/resourceGroups"}Create a public IP address
Section titled “Create a public IP address”Create a static Standard SKU public IP address:
az network public-ip create \ --name pip-demo \ --resource-group rg-pip-demo \ --location westeurope \ --sku Standard \ --allocation-method Static{ "publicIp": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo/providers/Microsoft.Network/publicIPAddresses/pip-demo", "idleTimeoutInMinutes": 4, "ipAddress": "20.115.40.220", "location": "westeurope", "name": "pip-demo", "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Static", "resourceGroup": "rg-pip-demo", "sku": { "name": "Standard", "tier": "Regional" }, "type": "Microsoft.Network/publicIPAddresses", ... }}Get and list public IP addresses
Section titled “Get and list public IP addresses”Retrieve the details of the public IP address and list all public IPs in the resource group:
az network public-ip show \ --name pip-demo \ --resource-group rg-pip-demo{ "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo/providers/Microsoft.Network/publicIPAddresses/pip-demo", "idleTimeoutInMinutes": 4, "ipAddress": "20.115.40.220", "location": "westeurope", "name": "pip-demo", "provisioningState": "Succeeded", "publicIPAddressVersion": "IPv4", "publicIPAllocationMethod": "Static", "resourceGroup": "rg-pip-demo", "sku": { "name": "Standard", "tier": "Regional" }, "type": "Microsoft.Network/publicIPAddresses", ...}Then list all public IP addresses in the resource group:
az network public-ip list \ --resource-group rg-pip-demo[ { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo/providers/Microsoft.Network/publicIPAddresses/pip-demo", "ipAddress": "20.115.40.220", "location": "westeurope", "name": "pip-demo", "provisioningState": "Succeeded", "publicIPAllocationMethod": "Static", "sku": { "name": "Standard", "tier": "Regional" }, "type": "Microsoft.Network/publicIPAddresses", ... }]List all public IPs in a subscription
Section titled “List all public IPs in a subscription”List every public IP address across the entire subscription:
az network public-ip list \ --output tableName ResourceGroup Location Zones Address IdleTimeoutInMinutes ProvisioningState-------- --------------- ---------- ------- ------------- ---------------------- -------------------pip-demo rg-pip-demo westeurope 20.115.40.220 4 SucceededThen list all public IP addresses in the resource group:
az network public-ip list \ --resource-group rg-pip-demo \ --output tableName ResourceGroup Location Zones Address IdleTimeoutInMinutes ProvisioningState-------- --------------- ---------- ------- ------------- ---------------------- -------------------pip-demo rg-pip-demo westeurope 20.115.40.220 4 SucceededDelete the public IP address
Section titled “Delete the public IP address”Delete the public IP address and verify it no longer appears in the list:
az network public-ip delete \ --name pip-demo \ --resource-group rg-pip-demoThen list all public IP addresses to confirm the resource group is now empty:
az network public-ip list --resource-group rg-pip-demo[]Features
Section titled “Features”The Public IP Address emulator supports the following features:
- Create and manage public IPs: Full lifecycle management including create, get, update, list, and delete.
- Static and dynamic allocation: Configure
StaticorDynamicIP allocation methods. - SKU tiers: Support for
BasicandStandardSKUs. - IPv4 and IPv6: Store and return the IP address version.
- DNS name labels: Associate a DNS name label with a public IP.
- Tags: Apply and update resource tags on public IP address resources.
- Resource group and subscription-scoped listing: List public IPs scoped to a resource group or across the entire subscription.
- Zone configuration: Record and return availability zone assignments.
Limitations
Section titled “Limitations”- No real IP allocation: Public IP Address is a mock implementation. No actual IP addresses are allocated from Azure’s public IP pools, and no public internet connectivity is provided.
- Allocation method not enforced: Dynamic and Static allocation methods are stored and returned, but no real IP assignment behavior is simulated.
- No data persistence: Public IP address resources are not persisted and are lost when the emulator is stopped or restarted.
Samples
Section titled “Samples”The following samples demonstrate how to use Azure Public IP Addresses with LocalStack for Azure:
API Coverage
Section titled “API Coverage”| Operation ▲ | Implemented ▼ |
|---|