View network interfaces and IP for ARM VMs

John Savill

August 15, 2017

1 Min Read
ITPro Today logo

Q. How can I view the network interfaces and IP addresses for an ARM VM using PowerShell?

A. Azure VMs can have multiple network adapters and multiple IP configurations per network adapter which means to view this information there are a few sub-objects we need to examine to get the desired information.

First we need to get a reference to the VM itself. For example:

$vm = Get-AzureRmVM -ResourceGroupName "RG-SCUSA" -Name "DummyVM"

This contains a NetworkProfile which in turn has an array of network interfaces. To look at the first one we could use:

Get-AzureRmResource -ResourceId $vm.NetworkProfile.NetworkInterfaces[0].Id | Get-AzureRmNetworkInterface

We could also get a reference to the NIC, for example:

 $vmNIC = Get-AzureRmNetworkInterface | where {$_.Id -eq $vm.NetworkProfile.NetworkInterfaces[0].Id}

The NIC then has an array of IP configurations which have properties such as the private IP address, for example:

PS C:Usersjohn> $vmNIC.IpConfigurations[0].PrivateIpAddress

You can experiment looking at the various objects and the attributes to get the exact information you care about.

About the Author(s)

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like