Deploying a Public IP Prefix

Preview

During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in

Deploying a Public IP Prefix

This guide shows you how to deploy a Public IP Prefix against Locally, and create Public IP Addresses from it. As with the other guides we're going to use the Azure CLI, but the same resources can be provisioned with HashiCorp Terraform, Pulumi or Bicep too.

Before you start

Plugin required

Locally v2026.10+ automatically installs this Resource Provider plugin when its Resource Provider is registered, but you can also install it via:

$ locally plugin install --name Microsoft.Network

1. Start Locally

Firstly, we need to launch Locally which we can do from a terminal by running:

$ locally build

Once Locally has started, the Locally Dashboard will open automatically:

Screenshot of the Locally Dashboard

2. Create a Resource Group

Next we can create the Resource Group:

$ locally run az group create -n sample-ip-prefix -l berlin

There's two things to note here:

  1. The Azure CLI supports Automatic Configuration, meaning that it can automatically be configured to work against Locally just by prefixing commands with locally run.
  2. Locally intentionally uses a different set of locations to Azure as a safety precaution, so that you can be confident you're deploying against Locally rather than regular Azure. You can also configure Locally to use the Azure locations too, but you'll want to be extra sure that you're prefixing commands with locally run when you do.

3. Create the Public IP Prefix

A Public IP Prefix reserves a contiguous block of addresses. We'll create a Regional /30, which holds four:

$ locally run az network public-ip prefix create -g sample-ip-prefix -n sample-prefix --length 30 --tier Regional --query "{name:name, prefix:ipPrefix, length:prefixLength, sku:sku.name, tier:sku.tier, state:provisioningState}"
{
  "length": 30,
  "name": "sample-prefix",
  "prefix": "36.42.27.56/30",
  "sku": "Standard",
  "state": "Succeeded",
  "tier": "Regional"
}

4. Create Public IP Addresses from it

Now we can create Public IP Addresses from the prefix:

$ locally run az network public-ip create -g sample-ip-prefix -n sample-pip-1 --sku Standard --public-ip-prefix sample-prefix --query "publicIp.{name:name, ip:ipAddress, prefix:publicIPPrefix.id}"
{
  "ip": "127.1.0.1",
  "name": "sample-pip-1",
  "prefix": "/subscriptions/0f766306-391f-4f66-b9ee-927fb2db629c/resourceGroups/sample-ip-prefix/providers/Microsoft.Network/publicIPPrefixes/sample-prefix"
}
$ locally run az network public-ip create -g sample-ip-prefix -n sample-pip-2 --sku Standard --public-ip-prefix sample-prefix --query "publicIp.{name:name, ip:ipAddress, prefix:publicIPPrefix.id}"
{
  "ip": "127.1.0.2",
  "name": "sample-pip-2",
  "prefix": "/subscriptions/0f766306-391f-4f66-b9ee-927fb2db629c/resourceGroups/sample-ip-prefix/providers/Microsoft.Network/publicIPPrefixes/sample-prefix"
}

Note

Each Public IP Address records the prefix it came from, but its address isn't taken from the prefix's range yet - Locally gives it one from a loopback range on your machine, as it does for any other Public IP Address. We will fix this in a future release.

5. List the Public IP Prefixes

To see the Public IP Prefixes in the Resource Group:

$ locally run az network public-ip prefix list -g sample-ip-prefix --query "[].{Name:name, Prefix:ipPrefix, Length:prefixLength, State:provisioningState}" -o table
Name           Prefix          Length    State
-------------  --------------  --------  ---------
sample-prefix  36.42.27.56/30  30        Succeeded

We can see the Public IP Prefix in the Locally Dashboard too:

Screenshot of the Public IP Prefix in the Locally Dashboard

6. Tidy up

To remove the Resource Group and everything within it:

$ locally run az group delete -n sample-ip-prefix --yes

Doing this with other tooling

Whilst this guide used the Azure CLI, Public IP Prefixes work the same way through any of the tooling that Locally supports - a Microsoft.Network/publicIPPrefixes resource in HashiCorp Terraform or OpenTofu, Pulumi, Bicep or an ARM Template all provision against Locally in the same way, with only the location changed.

Next steps

To give outbound traffic from a subnet one of these addresses, use them with a NAT Gateway. For inbound traffic, see Load Balancer.

Should you encounter any issues, please take a look at the troubleshooting section, reach out in our Discord or open an issue and we'll take a look.

Resource types this guide uses

These are the Azure resource types this guide creates in Locally:

Preview

During Public Preview you can use the Team plan for free, and get an early-adopter discount at GA. Sign in

A local cloud for you and your AI agents.

Your Azure infrastructure, running on your machine. Deploy in seconds, break things freely, and ship to Azure when you're ready.