Deploying a Route Table

Preview

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

Deploying a Route Table

This guide shows you how to deploy a Route Table against Locally, add routes to it and attach it to a subnet. 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-routes -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 Route Table

We'll create the Route Table with BGP route propagation turned off, so that only the routes we add apply to the subnet:

$ locally run az network route-table create -g sample-routes -n sample-rt --disable-bgp-route-propagation true --query "{name:name, disableBgpRoutePropagation:disableBgpRoutePropagation, state:provisioningState}"
{
  "disableBgpRoutePropagation": true,
  "name": "sample-rt",
  "state": "Succeeded"
}

4. Add some routes

A common setup sends all outbound traffic through a firewall. This route sends everything to a virtual appliance at 10.0.2.4:

$ locally run az network route-table route create -g sample-routes --route-table-name sample-rt -n to-firewall --address-prefix 0.0.0.0/0 --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.2.4 --query "{name:name, prefix:addressPrefix, nextHopType:nextHopType, nextHop:nextHopIpAddress, state:provisioningState}"
{
  "name": "to-firewall",
  "nextHop": "10.0.2.4",
  "nextHopType": "VirtualAppliance",
  "prefix": "0.0.0.0/0",
  "state": "Succeeded"
}

And this one drops any traffic for 192.168.0.0/16:

$ locally run az network route-table route create -g sample-routes --route-table-name sample-rt -n blackhole --address-prefix 192.168.0.0/16 --next-hop-type None --query "{name:name, prefix:addressPrefix, nextHopType:nextHopType, state:provisioningState}"
{
  "name": "blackhole",
  "nextHopType": "None",
  "prefix": "192.168.0.0/16",
  "state": "Succeeded"
}

A VirtualAppliance route needs an address to send traffic to, so leaving it out fails:

$ locally run az network route-table route create -g sample-routes --route-table-name sample-rt -n bad --address-prefix 10.10.0.0/16 --next-hop-type VirtualAppliance
ERROR: (NextHopIpAddressRequired) Route "bad" with nextHopType VirtualAppliance requires a nextHopIpAddress.
Code: NextHopIpAddressRequired
Message: Route "bad" with nextHopType VirtualAppliance requires a nextHopIpAddress.

5. Attach it to a subnet

A Route Table does nothing until a subnet uses it. We'll create a Virtual Network with a single subnet:

$ locally run az network vnet create -g sample-routes -n sample-vnet --address-prefixes 10.0.0.0/16 --subnet-name workloads --subnet-prefixes 10.0.1.0/24

Then point the subnet at the Route Table:

$ locally run az network vnet subnet update -g sample-routes --vnet-name sample-vnet -n workloads --route-table sample-rt --query "{name:name, prefix:addressPrefix, routeTable:routeTable.id}"
{
  "name": "workloads",
  "prefix": "10.0.1.0/24",
  "routeTable": "/subscriptions/0f766306-391f-4f66-b9ee-927fb2db629c/resourceGroups/sample-routes/providers/Microsoft.Network/routeTables/sample-rt"
}

Note

Locally records the routes and which subnets use them, but doesn't route any traffic through them.

6. List the routes

To see the routes in the Route Table:

$ locally run az network route-table route list -g sample-routes --route-table-name sample-rt --query "[].{Name:name, Prefix:addressPrefix, NextHopType:nextHopType, NextHop:nextHopIpAddress}" -o table
Name         Prefix          NextHopType       NextHop
-----------  --------------  ----------------  ---------
blackhole    192.168.0.0/16  None
to-firewall  0.0.0.0/0       VirtualAppliance  10.0.2.4

We can see the Route Table and its routes in the Locally Dashboard too:

Screenshot of the Route Table in the Locally Dashboard

7. Tidy up

Finally, we can tidy up by removing the Resource Group and everything within it:

$ locally run az group delete -n sample-routes --yes

Doing this with other tooling

Whilst this guide used the Azure CLI, Route Tables work the same way through any of the tooling that Locally supports - a Microsoft.Network/routeTables 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 control what traffic the subnet allows, add a Network Security Group. To send outbound traffic from a fixed address instead, see NAT Gateway.

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.