Skip navigation

View network interfaces and IP for ARM VMs

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:\Users\john> $vmNIC.IpConfigurations[0].PrivateIpAddress
10.0.0.5

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

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish