Skip to content

Commit 4c228e7

Browse files
Azure Docs: Azure Public IP Address (#588)
Co-authored-by: Brian Rinaldi <brian.rinaldi@gmail.com>
1 parent a99c5fe commit 4c228e7

1 file changed

Lines changed: 228 additions & 0 deletions

File tree

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
---
2+
title: "Public IP Address"
3+
description: Get started with Azure Public IP Address on LocalStack
4+
template: doc
5+
---
6+
7+
import AzureFeatureCoverage from "../../../../components/feature-coverage/AzureFeatureCoverage";
8+
9+
## Introduction
10+
11+
Azure Public IP Address is a resource that provides a static or dynamic IP address reachable from the internet.
12+
Public IP addresses are assigned to Azure resources such as virtual machines, load balancers, application gateways, VPN gateways, and bastion hosts.
13+
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](https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/public-ip-addresses).
14+
15+
LocalStack for Azure provides a local environment for building and testing applications that make use of Public IP Addresses.
16+
The supported APIs are available on our [API Coverage section](#api-coverage), which provides information on the extent of Public IP Address's integration with LocalStack.
17+
18+
## Getting started
19+
20+
This guide is designed for users new to Public IP Addresses and assumes basic knowledge of the Azure CLI and our `azlocal` wrapper script.
21+
22+
Launch LocalStack using your preferred method. For more information, see [Introduction to LocalStack for Azure](/azure/getting-started/). Once the container is running, enable Azure CLI interception by running:
23+
24+
```bash
25+
azlocal start-interception
26+
```
27+
28+
This command points the `az` CLI away from the public Azure management REST API and toward the LocalStack for Azure emulator API.
29+
To revert this configuration, run:
30+
31+
```bash
32+
azlocal stop-interception
33+
```
34+
35+
This reconfigures the `az` CLI to send commands to the official Azure management REST API.
36+
37+
### Create a resource group
38+
39+
Create a resource group to hold all resources created in this guide:
40+
41+
```bash
42+
az group create \
43+
--name rg-pip-demo \
44+
--location westeurope
45+
```
46+
47+
```bash title="Output"
48+
{
49+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo",
50+
"location": "westeurope",
51+
"managedBy": null,
52+
"name": "rg-pip-demo",
53+
"properties": {
54+
"provisioningState": "Succeeded"
55+
},
56+
"tags": null,
57+
"type": "Microsoft.Resources/resourceGroups"
58+
}
59+
```
60+
61+
### Create a public IP address
62+
63+
Create a static Standard SKU public IP address:
64+
65+
```bash
66+
az network public-ip create \
67+
--name pip-demo \
68+
--resource-group rg-pip-demo \
69+
--location westeurope \
70+
--sku Standard \
71+
--allocation-method Static
72+
```
73+
74+
```bash title="Output"
75+
{
76+
"publicIp": {
77+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo/providers/Microsoft.Network/publicIPAddresses/pip-demo",
78+
"idleTimeoutInMinutes": 4,
79+
"ipAddress": "20.115.40.220",
80+
"location": "westeurope",
81+
"name": "pip-demo",
82+
"provisioningState": "Succeeded",
83+
"publicIPAddressVersion": "IPv4",
84+
"publicIPAllocationMethod": "Static",
85+
"resourceGroup": "rg-pip-demo",
86+
"sku": {
87+
"name": "Standard",
88+
"tier": "Regional"
89+
},
90+
"type": "Microsoft.Network/publicIPAddresses",
91+
...
92+
}
93+
}
94+
```
95+
96+
### Get and list public IP addresses
97+
98+
Retrieve the details of the public IP address and list all public IPs in the resource group:
99+
100+
```bash
101+
az network public-ip show \
102+
--name pip-demo \
103+
--resource-group rg-pip-demo
104+
```
105+
106+
```bash title="Output"
107+
{
108+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo/providers/Microsoft.Network/publicIPAddresses/pip-demo",
109+
"idleTimeoutInMinutes": 4,
110+
"ipAddress": "20.115.40.220",
111+
"location": "westeurope",
112+
"name": "pip-demo",
113+
"provisioningState": "Succeeded",
114+
"publicIPAddressVersion": "IPv4",
115+
"publicIPAllocationMethod": "Static",
116+
"resourceGroup": "rg-pip-demo",
117+
"sku": {
118+
"name": "Standard",
119+
"tier": "Regional"
120+
},
121+
"type": "Microsoft.Network/publicIPAddresses",
122+
...
123+
}
124+
```
125+
126+
127+
Then list all public IP addresses in the resource group:
128+
129+
```bash
130+
az network public-ip list \
131+
--resource-group rg-pip-demo
132+
```
133+
134+
```bash title="Output"
135+
[
136+
{
137+
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-pip-demo/providers/Microsoft.Network/publicIPAddresses/pip-demo",
138+
"ipAddress": "20.115.40.220",
139+
"location": "westeurope",
140+
"name": "pip-demo",
141+
"provisioningState": "Succeeded",
142+
"publicIPAddressVersion": "IPv4",
143+
"publicIPAllocationMethod": "Static",
144+
"sku": { "name": "Standard", "tier": "Regional" },
145+
"type": "Microsoft.Network/publicIPAddresses",
146+
...
147+
}
148+
]
149+
```
150+
151+
### List all public IPs in a subscription
152+
153+
List every public IP address across the entire subscription:
154+
155+
```bash
156+
az network public-ip list \
157+
--output table
158+
```
159+
160+
```bash title="Output"
161+
Name ResourceGroup Location Zones Address AddressVersion AllocationMethod IdleTimeoutInMinutes ProvisioningState
162+
-------- --------------- ---------- ------- ------------- ---------------- ------------------ ---------------------- -------------------
163+
pip-demo rg-pip-demo westeurope 20.115.40.220 IPv4 Static 4 Succeeded
164+
```
165+
166+
To show the same resources scoped to one resource group:
167+
168+
```bash
169+
az network public-ip list \
170+
--resource-group rg-pip-demo \
171+
--output table
172+
```
173+
174+
```bash title="Output"
175+
Name ResourceGroup Location Zones Address AddressVersion AllocationMethod IdleTimeoutInMinutes ProvisioningState
176+
-------- --------------- ---------- ------- ------------- ---------------- ------------------ ---------------------- -------------------
177+
pip-demo rg-pip-demo westeurope 20.115.40.220 IPv4 Static 4 Succeeded
178+
```
179+
180+
### Delete the public IP address
181+
182+
Delete the public IP address and verify it no longer appears in the list:
183+
184+
```bash
185+
az network public-ip delete \
186+
--name pip-demo \
187+
--resource-group rg-pip-demo
188+
```
189+
190+
Then list all public IP addresses to confirm the resource group is now empty:
191+
192+
```bash
193+
az network public-ip list --resource-group rg-pip-demo
194+
```
195+
196+
```bash title="Output"
197+
[]
198+
```
199+
200+
## Features
201+
202+
The Public IP Address emulator supports the following features:
203+
204+
- **Create and manage public IPs**: Full lifecycle management including create, get, update, list, and delete.
205+
- **Static and dynamic allocation**: Configure `Static` or `Dynamic` IP allocation methods.
206+
- **SKU tiers**: Support for `Basic` and `Standard` SKUs.
207+
- **IPv4 and IPv6**: Store and return the IP address version.
208+
- **DNS name labels**: Associate a DNS name label with a public IP.
209+
- **Tags**: Apply and update resource tags on public IP address resources.
210+
- **Resource group and subscription-scoped listing**: List public IPs scoped to a resource group or across the entire subscription.
211+
- **Zone configuration**: Record and return availability zone assignments.
212+
213+
## Limitations
214+
215+
- **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.
216+
- **Allocation method not enforced**: Dynamic and Static allocation methods are stored and returned, but no real IP assignment behavior is simulated.
217+
- **No data persistence**: Public IP address resources are not persisted and are lost when the emulator is stopped or restarted.
218+
219+
## Samples
220+
221+
The following samples demonstrate how to use Azure Public IP Addresses with LocalStack for Azure:
222+
223+
- [Function App and Service Bus](https://github.com/localstack/localstack-azure-samples/tree/main/samples/function-app-service-bus/dotnet/)
224+
- [Web App and Cosmos DB for MongoDB API](https://github.com/localstack/localstack-azure-samples/tree/main/samples/web-app-cosmosdb-mongodb-api/python/)
225+
226+
## API Coverage
227+
228+
<AzureFeatureCoverage service="Microsoft.Network" client:load />

0 commit comments

Comments
 (0)