Azure Portal : Create a virtual machine with multiple network adapters

TOPE Georges-Emmanuel
4 min readDec 23, 2017

--

How to create an Azure VM with multiple network interfaces ?

It’s a question that often comes up in the Azure forums, and not an easy one to answer due to the way Azure evolves, and the limitations of each approach.

In the past, it was only possible to use PowerShell, Azure CLI or Azure Resource Manager, and only during the creation of a virtual machine.

A lot of things changed over the time, and now it’s possible to attach a network interface to a virtual machine after its creation, even from the portal.

At the time of writing, all the General Purpose VM Sizes support at least 2 NICs, and the max number of NICs you can attach is available here : https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes

Although, all the network interfaces attached to a VM must remain in the same VNET.

Creating the virtual machine

Sometimes, it's required to use more than one network adapter with a computer, as for deploying Skype for Business Edge servers.

A best practice is then to put a gateway on only one adapter holding the de-facto default network route, configure DNS settings on another adapter, and define some custom routes to describe how the traffic must flow to the different subnets.

Azure network interfaces are configured through DHCP and the first adapter attached to a VM will likely have both the gateway and DNS settings set by default.

Never try to edit its settings unless there is another adapter properly configured with appropriate routes.

I'm not going to show how to create a VM in Azure because it's over-documented (https://docs.microsoft.com/en-us/azure/virtual-machines/windows/quick-create-portal)

Creating a network interface from the portal

Here are the steps for creating a NIC from the portal :

  • From the portal, select New and enter Network Interface into the search area
  • From the resulting blade, select Network Interface and click on the Create button
  • Configure your network interface as per your requirements, and click on Create to submit.
  • The process takes less than 10 seconds, so look at the top-right corner of your browser for a similar notification, to ensure there was no error before proceeding to the next step.

After the creation of the NIC, you're ready to attach it to an existing VM.

Attaching a network adapter to an existing virtual machine

From the portal, highlight the virtual machine you want to customize and shut it down before going further.

  • Hit Stop to shutdown the virtual machine
  • Ensure the status reads Stopped (deallocated) before going to the next step
  • Select the Networking tab under the Settings group, and in the resulting blade, click on Attach network interface, select the NIC you just created and click OK to submit.
  • A few seconds later, you should have a second tab named after the just-attached network interface

Now that you know how to setup a VM with multiple network interface from the portal, what's next ?

You should specify how the VM should route traffic to your subnets by defining custom routes. Let's start your virtual machine.

Configure custom routes within the virtual machine

I’ll not cover how to edit routes from your virtual machine as there is already enough documentation for Linux and Windows.

http://www.octopuscs.com/blogs/Linux/How-to-edit-static-routes-in-a-linux-machine

https://www.howtogeek.com/howto/windows/adding-a-tcpip-route-to-the-windows-routing-table/

I would only suggest you to avoid creating persistent routes at first, so that you can restart the VM to revert your changes if you have any issue.

--

--