Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
How to find the private IP address of VM in AZ Module
Step 1: Find your VM details
$VM = Get-AzVm -name "Your VM Name"
Step 2: Set the NetworkInterface Profile to a variable. The NeworkInterfaceID will be having a value separated by "/" and profile name at the end.
$Profile =$VM.NetworkProfile.NetworkInterfaces.Id.Split("/") | Select -Last 1
Step 3: From ProfileName we will fetch the networkinterface details to a variable
$IPConfig = Get-AzNetworkInterface -Name $Profile
Step 4: The following will have the Private IP address value configured for the specific VM
$IPAddress = $IPConfig.IpConfigurations.PrivateIpAddress
Note: If multiple NIC are attached to a VM, you will have to loop in Step 2