Microsoft Azure : How to create a virtual machine with multiple network interfaces

When you are designing a network, the ability to have a secure gateway between subnets is vital. Therefor we’ll be looking into the possibility to create a virtual machine with multiple network interfaces.

What is possible?

Be aware that the size of your virtual machine will influence the amount of NICs you can create / configure ;

2015-02-02 09_52_25-Create a VM with Multiple NICs

It was also a surprise for me that it is (currently) not possible to add/remove NICs after the creation of the virtual machine. Trust me, I’ve tried and a nice warning tells me that this is not supported.

2015-02-02 09_52_36-Create a VM with Multiple NICsMore details can be found on the Azure documentation page “Create a VM with Multiple NICs“.

 Let’s try this one out!

 

Our Test Environment

We’ll have a virtual network with three subnet and we’ll create a machine that is linked to two of them.

kvaes-azure-multiple-nics-topology

Possible use cases?

  • Firewall
  • Load Balancer
  • Back-Up System
  • Management System

 

Step One ; Configure your Azure PowerShell to use your Azure Account

  • Open an Azure PowerShell.
  • To download your publishsettingsfile, enter:
    Get-AzurePublishSettingsFile
  • The download pop-up of your browser opens. Save the file.
  • Import the publishsettingsfile by entering:
    Import-AzurePublishSettingsFile PATH_TO_FILE

 

Step Two ; Setup the basics

  • Via the portal, create a virtual network “MULTIPLENICS” with three subnets ;
    2015-02-02 11_28_36-Networks - Windows Azure
  • Configure a storage account “multiplenicskvaes” ;2015-02-02 11_30_11-Storage - Windows Azure
  • Link the storage account to your subscription in Azure Powershell ;

    PS C:\> Get-AzureStorageAccount "multiplenicskvaes"2015-02-02 11_36_58-Microsoft Azure PowerShell
    PS C:\> Set-AzureSubscription -SubscriptionName "Gratis proefversie" -CurrentStorageAccount multiplenicskvaes
    PS C:\> Get-AzureSubscription

    2015-02-02 11_37_15-Microsoft Azure PowerShell

  • Get the image we want to use for our deployment. In this example, we’ll take the most recent Windows image ;

    PS C:\> $image = Get-AzureVMImage | where { $_.ImageFamily -Match "Windows*"} | sort PublishedDate -Descending | select -ExpandProperty ImageName -First 1

    2015-02-02 11_40_15-Microsoft Azure PowerShell

 

Step 3 ; Let’s create some VMs!

  • Create a basic configuration (plus account to login)
    PS C:\> $vm01 = New-AzureVMConfig -Name "KVAES01" -InstanceSize ExtraLarge -Image $image -AvailabilitySetName "KVAESNICSCLUSTER"
    PS C:\> Add-AzureProvisioningConfig -Windows -AdminUsername "demouser" -Password "Demo1234?" -VM $vm01

2015-02-02 11_53_15-Microsoft Azure PowerShell

  • Let’s add the machine to a given subnet

    PS C:\> Set-AzureSubnet -SubnetName "TIER000" -VM $vm01

    2015-02-02 11_53_24-Microsoft Azure PowerShell

  • Now let’s add an additional NIC from another subnet

    PS C:\> Add-AzureNetworkInterfaceConfig -Name "NIC1" -SubnetName "TIER001" -StaticVNetIPAddress "192.168.1.100" -VM $vm01

    2015-02-02 11_54_19-Microsoft Azure PowerShell

  • And finally, let’s press “create” 🙂

    PS C:\> New-AzureVM -ServiceName "KVAES01" -VM $vm01 -Location "West Europe" -VNetName "MULTIPLENICS"

    2015-02-02 11_58_36-Microsoft Azure PowerShell
    2015-02-02 12_00_50-Virtual machines - Windows Azure

Step 4 ; Verify that everything went according to plan!

  • Wait for the machine to leave the “Provisioning” state
    (good time to get some coffee/tea/… whatever)
  • Let’s note down the public ip & port which we’ll need to use for the “Remote Desktop Connection” .
    2015-02-02 12_12_06-Virtual machines - Windows Azure 2015-02-02 12_12_22-Virtual machines - Windows Azure
  • And let’s connect to it…
    2015-02-02 12_13_29-Remote Desktop Connection
  • Startup the console and type “ipconfig” to see what network interfaces are available
    2015-02-02 12_15_21-104.40.221.90_64205 - Remote Desktop Connection

Import things to remember

  • (Currently) you can only add/remove network interfaces upon creation.
  • Despite that the feature is not visible via the GUI, you are able to use multiple NICs in different subnets.
  • The limitation in regards to the number of NICs is related to the machine type.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s