Find network interface object for an Azure VM
Find the network interface for an Azure ARM VM
John Savill
August 12, 2016
1 Min Read
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 objectGet-AzureRmNetworkInterface | Where { $_.Id -eq $MyVM.NetworkInterfaceIDs[0]}#orGet-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.
About the Author
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