Pick the next available CIDR prefix from an Azure Virtual Network Manager IPAM pool
Project description
avnm-pool-cidr
Pick the next free CIDR prefix from an Azure Virtual Network Manager (AVNM)
IPAM pool — without manually scrolling through the Azure portal or writing yet
another ipaddress-and-az-CLI bash one-liner.
Why
AVNM IPAM is the right way to centralize CIDR allocation across an Azure tenant,
but the day-to-day operator workflow ("give me a free /24 from prod-pool") is
not yet a first-class CLI verb in az. This tool fills the gap with three
focused commands.
Install
pipx install avnm-pool-cidr
You need az on your PATH and a current Azure login (az login). Auth is
delegated entirely to the Azure CLI — this tool does not embed credentials.
Usage
All commands take the same three locator options (each also reads from an environment variable):
| Option | Env var | Description |
|---|---|---|
--subscription/-s |
AZURE_SUBSCRIPTION_ID |
Subscription containing the VNM |
--resource-group/-g |
AZURE_RESOURCE_GROUP |
RG containing the network manager |
--network-manager/-n |
AZURE_NETWORK_MANAGER |
Name of the network manager |
# 1. Find the next free /24 in prod-pool
apc next-prefix prod-pool --size 24 \
-s 11111111-1111-1111-1111-111111111111 \
-g rg-network -n vnm-prod
# -> 10.0.5.0/24
# 2. List every resource that has reserved space from prod-pool
apc list prod-pool -s ... -g rg-network -n vnm-prod
# 3. Show address-level utilization (per parent prefix)
apc usage prod-pool -s ... -g rg-network -n vnm-prod
The short alias apc is installed alongside avnm-pool-cidr.
How it works
avnm-pool-cidr shells out to az network manager ipam-pool for the
authoritative pool/reservation data, then does the CIDR math in pure Python
(ipaddress stdlib). Splitting it this way keeps the math trivial to unit-test
and means the tool inherits whatever auth, proxy, and ARM endpoint settings your
az install already has.
Companion tool
This is the second tool in a series of small Azure operator CLIs. The first is
azkv-ssh-fetch — for fetching
SSH private keys from Key Vault and connecting through Azure Bastion in one step.
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
ruff check . && ruff format --check .
mypy src
pytest --cov
Test layers
| Layer | What it covers | Where |
|---|---|---|
| Unit | Pure CIDR math (tests/test_cidr.py) and inline-mocked az calls (tests/test_ipam.py, tests/test_cli.py) |
Every CI run, no network |
| Snapshot | Full CLI run against scrubbed JSON fixtures of real az network manager ipam-pool ... output (tests/test_cli_with_fixtures.py) |
Every CI run, no network |
| Smoke | Operator-run live check against a personal Azure subscription | Pre-tag, manual |
Snapshot fixtures live in tests/fixtures/. Re-record with
scripts/record-fixtures.sh (refuses to run against Microsoft-internal tenants;
scrubs subscription/RG/VNM names and all GUIDs before writing).
License
MIT © 2026 Naeem Hossain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file avnm_pool_cidr-0.1.0.tar.gz.
File metadata
- Download URL: avnm_pool_cidr-0.1.0.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1d3955bc004d8b8c264c43042ac9060d8a90c4cc92abfb1efe1c8860891aae3
|
|
| MD5 |
bc079784c2f6ed9e73d3ca9ce7c884e2
|
|
| BLAKE2b-256 |
77e4e940e5c50ef309aa78c63426a0a04bbd369f45fd2837a5a678d45ad42620
|
Provenance
The following attestation bundles were made for avnm_pool_cidr-0.1.0.tar.gz:
Publisher:
release.yml on NaeemH/avnm-pool-cidr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
avnm_pool_cidr-0.1.0.tar.gz -
Subject digest:
c1d3955bc004d8b8c264c43042ac9060d8a90c4cc92abfb1efe1c8860891aae3 - Sigstore transparency entry: 1913793714
- Sigstore integration time:
-
Permalink:
NaeemH/avnm-pool-cidr@afce3063c5e1ca1c326d4e2d23ca0f9d113abe51 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NaeemH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@afce3063c5e1ca1c326d4e2d23ca0f9d113abe51 -
Trigger Event:
push
-
Statement type:
File details
Details for the file avnm_pool_cidr-0.1.0-py3-none-any.whl.
File metadata
- Download URL: avnm_pool_cidr-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
479e109b5bea8db11a70b68fc5a573ef06ed7b0f3cdc57f3cc5110bc513c2d6e
|
|
| MD5 |
d694d92824b59f15760570cedaf5164e
|
|
| BLAKE2b-256 |
95bd5ef276f90dc6aa08211e01e0d2e666c7a8276657c7f2c29a46b75711dc55
|
Provenance
The following attestation bundles were made for avnm_pool_cidr-0.1.0-py3-none-any.whl:
Publisher:
release.yml on NaeemH/avnm-pool-cidr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
avnm_pool_cidr-0.1.0-py3-none-any.whl -
Subject digest:
479e109b5bea8db11a70b68fc5a573ef06ed7b0f3cdc57f3cc5110bc513c2d6e - Sigstore transparency entry: 1913793858
- Sigstore integration time:
-
Permalink:
NaeemH/avnm-pool-cidr@afce3063c5e1ca1c326d4e2d23ca0f9d113abe51 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/NaeemH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@afce3063c5e1ca1c326d4e2d23ca0f9d113abe51 -
Trigger Event:
push
-
Statement type: