Azure: remove unassociated public IPs

Azure bills every static public IP by the hour, associated or not. How to find them with az network, dissociate, delete and prevent them with Terraform.

A static public IP with no association, or held by a NIC whose VM no longer exists, is billed by the hour even though it serves no traffic.

Policy at a glance

Provider
Azure
Resource
Azure public IP addresses (Standard SKU, always static).
What to check
IPs with no ipConfiguration and no NAT gateway, and those associated with a NIC whose VM no longer exists.
Risk
Medium: a deleted static IP cannot be recovered. Check DNS and allow-lists first.
Effort
Low: one query per subscription and one delete per address.

Why it matters: a static IP bills even with nothing to point at

The FAQ on Azure's IP address pricing page settles it in one line: a static public IP is charged irrespective of the associated resource. The clock starts the second hour after you create it (to give you time to assign it) and stops only when you delete the IP resource. Partial hours are billed as full hours.

Since the Basic SKU was retired on 30 September 2025, new public IPs are Standard, and a Standard IP is always static: it is assigned at creation and not released until you delete the resource. That is why dissociating it from a VM saves nothing; only deleting it stops the charge.

Azure's public price API (Azure Retail Prices, queried on 15 November 2026, East US region) returns USD 0.005 per hour for "Standard IPv4 Static Public IP": about USD 3.60 per address in a 30-day month. It is little per IP, but it adds up in subscriptions where every lab leaves one behind.

There is a case the association column does not show: deleting a VM does not delete its network interface (NIC) unless you ask for it, and that NIC keeps holding the public IP. The address shows as associated, serves nobody, and every attempt to delete it fails while the NIC exists.

In the portal: Public IP addresses lists them all; the Associated to column is empty for the ones with no association. On each IP, Overview shows which resource it is associated with.

With the official CLI, every public IP carries the ipConfiguration property when it is associated with a NIC, a load balancer or another resource with an IP configuration; a NAT gateway is associated separately. This query lists the ones with neither, and the second the NICs with no VM, which are the ones holding IPs:

az network public-ip list \
  --query "[?ipConfiguration==null && natGateway==null].{Name:name,Group:resourceGroup,IP:ipAddress}" \
  --output table

az network nic list \
  --query "[?virtualMachine==null].{NIC:name,Group:resourceGroup}" --output table

The list of NICs with no VM needs a human look: private endpoint interfaces have no VM either and are in use. Before touching one, open it and check which resource it belongs to.

How to fix it, step by step

Terraform example: the IP in the same state as its NIC

The simplest way to avoid loose IPs is for them never to exist outside a state: the public IP and the NIC that uses it are declared together, with an explicit reference. That way terraform destroy removes them in the right order (the NIC first, then the IP) and a plan shows any drift if someone dissociates it by hand.

provider "azurerm" {
  features {}
}

variable "resource_group" { type = string }
variable "location" { type = string }
variable "subnet_id" { type = string }

# The IP and the NIC that uses it, together in the same state.
resource "azurerm_public_ip" "web" {
  name                = "web-pip"
  resource_group_name = var.resource_group
  location            = var.location
  allocation_method   = "Static"
  sku                 = "Standard"
}

resource "azurerm_network_interface" "web" {
  name                = "web-nic"
  resource_group_name = var.resource_group
  location            = var.location

  ip_configuration {
    name                          = "ipconfig1"
    subnet_id                     = var.subnet_id
    private_ip_address_allocation = "Dynamic"
    public_ip_address_id          = azurerm_public_ip.web.id
  }
}

Validated with terraform validate (Terraform 1.17.2, hashicorp/azurerm provider 4.81.0).

How Control Cloud surfaces it

Control Cloud resolves what each public IP points at (a NIC, a load balancer or nothing) and flags both shapes of the problem as orphans: the unassociated IP and the one held by a NIC with no VM, shown with the warning "orphan NIC — still billing". The public IPs tab has an "Orphans" filter, and when you delete a VM the app warns that Azure leaves the NIC and the IP behind. When you delete such an IP from the app, it first frees the orphan NIC holding it and then retries.

When not to apply it

Frequently asked questions

Does Azure charge for a public IP that is not associated with anything?

Yes, if it is static, and every Standard IP is. The pricing page says a static IP is charged irrespective of the associated resource; in East US it is USD 0.005 per hour according to the price API (15 November 2026).

Why can't I delete a public IP in Azure?

Because it is still associated with an IP configuration or a NIC. Most often it is a NIC that outlived the VM: dissociate the IP or delete that NIC, then delete the IP.

Does dissociating the IP from the VM stop the charge?

No. According to the pricing page, the clock on a static IP stops when you delete the IP resource. Dissociated, it stays reserved in your name and billing.

Related policies: Azure: delete unattached managed disks · AWS: release unassociated Elastic IPs · Google Cloud: release unused static external IPs

Glossary terms: Compartment / Resource Group · Terraform · Drift

Official sources

  1. Azure — IP address pricing (FAQ)
  2. Azure — Public IP addresses
  3. Azure — Create, change, or delete a public IP address
  4. Azure — Dissociate a public IP address from a VM
  5. Azure — Delete a VM and its attached resources
  6. Azure Retail Prices API

Ready to see it on your own infrastructure? Book a demo · Read the documentation