Find network interface object for an Azure VM

Find network interface object for an Azure VM

Q. How can I get the network interface object for a specific Azure VM?

A. With Azure Resource Manager the NIC is its own separate object that is referenced by the VM resource. To get the network adapter object for a VM use one of the following:

$MyVM = Get-AzureRmVM -ResourceGroupName "RG-SCUSA" -Name "DummyVM"
#To get the actual network adapter object
Get-AzureRmNetworkInterface | Where { $_.Id -eq $MyVM.NetworkInterfaceIDs[0]}
Get-AzureRmResource -ResourceId $MyVM.NetworkInterfaceIDs[0] | Get-AzureRmNetworkInterface

If you examined $MyVM you will note the NetworkInterfaceID is an array of IDs then either of the previous commands converts that ID to an actual network interface object.

Hide 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.