Retrieve Azure Subnets Connected to Virtual Network Using PowerShell



To get all the subnets attached to the virtual network using PowerShell, we need to use the GetAzVirtualNetwork command.

PS C:\> $vn = Get-AzVirtualNetwork -Name VirtualNetworkName

To get the Subnets and its address prefix details, you need to filter out the Subnets and AddressPrefix

PS C:\> $vn.Subnets | Select Name, AddressPrefix
Updated on: 2021-08-31T09:38:11+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements