May 27th, 2016

PowerTip: List Azure Resource Manager virtual networks with PowerShell

Doctor Scripto
Scripter

Summary: Use the AzureRM cmdlets to list all available virtual networks in a subscription.

Hey, Scripting Guy! Question I’m doing work for a client who forgot to give me a list of the virtual networks in the client’s Azure subscription. Could you save me some time and show me how to get that list?

Hey, Scripting Guy! Answer Just use the Get-AzureRMVirtualNetwork cmdlet. This will dump the output to the screen in a long list. If you’d like something more readable, such as the name, location and the subnet that it controls, try this one liner:

Get-AzureRmVirtualNetwork | Select-Object Name, Location,@{Name='Network'; Expression={$_.AddressSpace.AddressPrefixes}}

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.