Beginner · Foundations · 4 of 15

Find a VM's NIC and private IP

Your tasks
  • Inspect vm-web2's network interface

A developer asks what private IP address vm-web2 has and which subnet of vnet-app it lives in. VMs don't hold IPs directly. Their network interface (NIC) does, and vm-web2's is called vm-web2-nic. Find both answers from the NIC.

You'll learn
Network interfaces
  1. List the IP configurations on vm-web2's NIC.

    az network nic ip-config list -g rg-lab --nic-name vm-web2-nic -o table
    What's this?

    Shows a network interface's IP configuration: its private IP and subnet.

    • -g the resource group the resources live in
    • --nic-name vm-web2-nic the network interface to inspect
  2. Or pull one field out of the full NIC with --query.

    az network nic show -g rg-lab --name vm-web2-nic --query "ipConfigurations[0].privateIPAddress"
    What's this?

    Shows a VM's network interface: its IP address and what is attached to it.

    • -g the resource group the resources live in
    • --name the name of the thing to look at or change
  3. Answer the questions below.

Sources on Microsoft Learn (3)
0/0 changes
Network map
?
  • Resource group, the outer dashed frame
  • Virtual network, with its address space top right
  • Subnet, with range and usable IPs (5 reserved)
  • Network security group. A small shield on a VM's NIC means the NIC has one too
  • Route table on the subnet
  • NICVM Appliance Private endpoint
  • Peering Connected Initiated or access off
  • Goal working Goal broken, X marks where it stops
  • Private DNS zone, dotted lines go to linked VNets
  • Orange pulse: what your last command changed. Drag to pan, Ctrl and scroll to zoom.
Resource grouprg-labvnet-app: tap to inspectVirtual networkvnet-app10.1.0.0/16subnet-web: tap to inspectsubnet-web10.1.1.0/24 · 251 usablevm-web 10.1.1.4: tap to inspectNICvm-web10.1.1.4vm-web2 10.1.1.5: tap to inspectNICvm-web210.1.1.5subnet-db: tap to inspectsubnet-db10.1.2.0/24 · 251 usablevm-db 10.1.2.4: tap to inspectNICvm-db10.1.2.4
Goals 0/3
Cloud Shell · bashVMsrg-lab · eastus2
cloudshell:~$