June 3rd, 2016

PowerTip: List all virtual network subnets by using PowerShell

Doctor Scripto
Scripter

Summary: Use the Azure Resource Manager cmdlets to identify all the available subnets in a particular virtual network.

Hey, Scripting Guy! Question I’m trying to figure out a way to list all the subnet configurations in a virtual network in Azure Resource Manager. Got any tips?

Hey, Scripting Guy! Answer How about the answer? It’s a matter of combining the Get-AzureRMVirtualNetwork cmdlet and Get-AzureRMVirtualNetworkSubnetConfig. Here is an example:

Get-AzureRmVirtualNetwork -Name HSG-VirtualNetwork -ResourceGroupName HSG-AzureRG | Get-AzureRmVirtualNetworkSubnetConfig | Format-Table

The Doctor

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.