Enable Internet Inside Azure Hyper-V guest Virtual Machines

Last week I showed you how to install and run Hyper-V on an Azure Virtual Machine and deploy Windows Server 2019 as a guest VM.

By default, after installing Hyper-V on an Azure VM internet is not working for the guest Virtual Machine and today I will show you how I create NAT virtual switch and enable internet for guest VMs.

Create Switch

To enable internet access, I will run a few PowerShell cmdlets that will create NAT Switch that will allow VMs connected to the switch access to the internet.

Starting with the cmdlet below, I will create a Virtual NAT switch called Internal

New-VMSwitch -Name "InternalNATSwitch" -SwitchType Internal

Note Adapter Number

Once my switch has been created, I will run the cmdlet below to find the Virtual Switch ifIndex number which is number 18.


Create Default Gateway IP Address

New-NetIPAddress -IPAddress -PrefixLength 24 -InterfaceIndex 18

Network Address Translation (NAT)

In the cmdlet below, I will create the NAT subnet with the address space which means that all the VM that I will create will need to be in the range of the subnet.

new-NetNat -Name "InternalNat" -InternalIPInterfaceAddressPrefix

Configure Subnet on the VM

Now that my subnet is ready, I will open my Windows Server 2019 Virtual Machine and set the network adapter to be in the InternalNATSwitch

Configure Network Interface

The final step is to configure the network adapter IP address to be in the same subnet as the NAT network with the default gateway of the NAT (

Now, I can open the browser on the VM and use the internet