How To Create An Azure VM With Multiple NICs

We will use the following blog post as guidance.

https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-multiple-nics/

Updating version of Azure PowerShell

Before we begin we will need to make sure that we have the latest version of Azure PowerShell tooling in our environment. Initial instructions on how to install Azure PowerShell from scratch can be found here:

https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/

If you have already installed PowerShell before, you will just need to update it. The link below will run the Web Platform Installer and suggest updating to the latest version of Azure PowerShell.

http://go.microsoft.com/fwlink/p/?linkid=320376&clcid=0x409

clip_image002

PowerShell trivia

Add-AzureAccount – allows to login to the subscription account.

Get-AzureAccount – list all currently logged in Accounts.

Get-AzureSubscription – will list all Azure Subscriptions for currently logged on account.

Prerequisites

Important thing to note that VNet, Cloud Service and storage account must be created in the same region/datacenter.

Virtual Network

VNet will have the following configuration and located in “North Europe” datacenter

clip_image004

Storage Account

Storage account must be created in the “North Europe” datacenter. We will assume that the name is “n3l400sqlcluster”. Text highlighted with bold and red color will be specific to your account and will need to be changed accordingly.

Select Active subscription for the rest of PowerShell commands

To select “active” subscription we will use this command.

Set-AzureSubscription -SubscriptionName “Azure Pass O4S SQLCLUSTER” -CurrentStorageAccountName “n3l400sqlcluster

Cloud Service

For some reason New-AzureVM refuses to create new Cloud Service, so new CloudService must be created in the same region:

clip_image006

Cloud Service Name is: ppMultiNIC

Editing PowerShell to create the image

Fields in bold red will need to be changed to suit your environment.

#Select a VM image from Azure VM image gallery. Note that images change frequently and are available by region. The image specified in the example below may change or might not be in your region, so be sure to specify the image you need.

$adminuser = “adminuser

$adminpwd = “MyPassword_1

$image = (Get-AzureVMImage -Verbose:$false | Where-Object {$_.label -like “Windows Server 2012 R2 Datacenter*”} | Sort-Object –Descending PublishedDate)[0]

#Create a VM configuration.

$vm = New-AzureVMConfig -Name “MultiNicVM” -InstanceSize “ExtraLarge” -Image $image.ImageName –AvailabilitySetName “ppMyAVSet

#Create the default administrator login.

Add-AzureProvisioningConfig –VM $vm -Windows -AdminUserName $adminuser -Password $adminpwd

#Add additional NICs to the VM configuration.

Add-AzureNetworkInterfaceConfig -Name “Ethernet1” -SubnetName “Subnet-1” -StaticVNetIPAddress “10.0.0.213” -VM $vm

Add-AzureNetworkInterfaceConfig -Name “Ethernet2” -SubnetName “Subnet-2” -StaticVNetIPAddress “10.0.1.214” -VM $vm

#Specify the subnet and IP address for the default NIC.

Set-AzureSubnet -SubnetNames “Frontend” -VM $vm

Set-AzureStaticVNetIP -IPAddress “10.0.2.100” -VM $vm

#Create the VM in your virtual network.

New-AzureVM -ServiceName “ppMultiNIC” –VNetName “vn-cluster” –VMs $vm

 

VM is created

clip_image008

Checking Virtual Networks:

clip_image010

clip_image011

IPCONFIG /ALL

clip_image012

Pinging rest of the infrastructure

Domain Controller in that Lab is 10.0.0.10

clip_image014

Leave a Reply