Azure Subnet Visualisation

When working with Virtual Network (VNET) subnets in Azure, it can be tricky to quickly find the right IP space not currently allocated to a subnet. The Azure portal will propose an address range when you add a subnet, but this suggestion may not be the correct size and might not be appropriate if you are packing in subnets contiguously, or leaving space to do so in future projects.

The standard view you have to work with is simply a list of subnets within the VNET, along with their name and IPv4 CIDR notation.

I have put together some PowerShell which creates a visualisation of this data, creating rows of 255 addresses (dividing the VNET’s address space into /24’s), marking out the space allocated to subnets and denoting unused addresses with a green box. The list above becomes the chart below:

The PowerShell function source and some code to quickly deploy an example environment and test this function are both available on Go have a look if this might be useful in your environment.