0

How can I check which subnet is attached to my VM with azure power shell? I don't see any property to get subnet name.

I have tried to Get-AzureRmVM but there is no information about a subnet.

Yannick Meeus
  • 5,643
  • 1
  • 35
  • 34
Tushar Raichand
  • 91
  • 3
  • 12

1 Answers1

4

The following command will work if you have the name of the VM's NIC:

(Get-AzureRmNetworkInterface -name "VM_NIC Name").ipconfigurations.subnet.id

You can get the NIC ID from the following if you don't already have it:

(Get-AzureRmVM -name "VM Name").networkprofile.networkinterfaces.id
AdminOfThings
  • 23,946
  • 4
  • 17
  • 27