I am Dale Hayter, a Microsoft and VMware certified Technical Consultant.

My blog has been built up over the years from my experience of working on an IT helpdesk and also from being out on-site.

Create a Virtual Machine with 2 NICs in Azure Classic

Unfortunately, in Azure you cannot create a Virtual Machine in the GUI with 2 Network Cards. You cannot even add a 2nd NIC to a VM once it has been created. The only way to create a VM with 2, is to specify the additional NIC’s at the time of creation and ONLY via powershell. I have compiled a Powershell script that will do this. I have also listed the commands next to each comment to get the value to put there. Copy the code below into a PS1 and launch it from a PowerShell window

############## Change Values Below Here #############

# Set Subscription that will be used. Get-AzureSubscription
$subscr="Free Trial"

# Cloud Service Name. Get-AzureService
$svcname="Cloud Service"

#Set Storage Account VM will be created in. Get-AzureStorageAccount
$staccount="Storage01"

# Name of the VM Provisioned
$vmname="VM01"

# Instance Size of the VM required
$vmsize="Standard_DS2_v2"

# Virtual Network Name. Get-AzureVNetConfig
$vnetname="Virtual Network"

# OS you want to Deploy
# 2012 = "Windows Server 2012 R2 Datacenter"
# 2008 = "Windows Server 2008 R2 SP1"

$OSversion = "Windows Server 2008 R2 SP1"

# vNic1 IP Address
$vNic1IP = "10.0.2.11"
$vNic1Subnet = "Live"

# vNic2 IP Address
$vNic2Name = "Replication"
$vNic2IP = "10.0.1.11"
$vNic2Subnet = "Replication"

############# DO NOT CHANGE VALUES BELOW HERE ############

# Select Subscription and Storage
Set-AzureSubscription -SubscriptionName $subscr -CurrentStorageAccountName $staccount

# Get image for VM
$image = Get-AzureVMImage `
| where{$_.ImageFamily -eq $OSversion} `
| sort PublishedDate -Descending `
| select -ExpandProperty ImageName -First 1

# Creates a new VM config with the VM name, its Size and the Image Used
$vm1 = New-AzureVMConfig -Name $vmname -InstanceSize $vmsize `
-Image $image

# Asks you for the admin username and password for the machine

$cred=Get-Credential -Message "Type the name and password of the local administrator account."
$vm1 | Add-AzureProvisioningConfig -Windows -AdminUsername $cred.Username -Password $cred.GetNetworkCredential().Password

###### 2nd Network Card - Remove comments on next 2 lines if you need a 2nd NIC #

#Add-AzureNetworkInterfaceConfig -Name $vNic2Name `
# -SubnetName $vNic2Subnet -StaticVNetIPAddress $vNic2IP -VM $vm1

# Create vNic1 - Will be the Default Gateway so assign to Correct Subnet
Set-AzureSubnet -SubnetNames $vNic1Subnet -VM $vm1
Set-AzureStaticVNetIP -IPAddress $vNic1IP -VM $vm1

New-AzureVM -ServiceName $svcname –VNetName $vnetname –VMs $vm1