Sunday 25 November 2012

Creating VPN and Hosting Web application on Azure - Part 2


In last post, we have created VPN on Azure. As we are planning to use Database Mirroring concept in this POC, I need an Active Directory to configure mirroring. So in this post I am planning to create an Azure VM and install DNS and Active Directory.

There are three ways we can achieve creating a VM on Azure, using Management Portal, PowerShell script or by using REST API call. In this post, I am planning to show from Management portal and PowerShell script.

Before creating the VM, we need to decide the subnet under which the VM has to be created. As per last post, we created the VPN with the following three subnets –
  1. DNSSubnet - CIDR 10.79.1.0/24 – Range 10.79.1.0 - 10.79.1.255
  2. FESubnet – CIDR 10.79.2.0/24 – Range 10.79.2.0 - 10.79.2.255
  3. BESubnet – CIDR 10.79.3.0/24 – Range 10.79.3.0 - 10.79.3.255
As I am planning to install DNS and Active Directory on the server, I decide to go with DNSSubnet for this VM.

Creating Azure VM under the VPN using Management Portal

The following screenshots show walkthrough for creating VM under DNS Subnet of the VPN.

Step 1: Select NEW --> COMPUTE --> VIRTUAL MACHINE --> FROM GALLERY. The portal will popup to select the image for the VM.


Step 2: Under the PLATFORM IMAGES, select Windows Server 2012 image.


Press Next.

Step 3: Provide the VM Name and the password. Select the preferred size of the VM. I select Small as this is just a POC.


Press Next.

Step 4: Select the STANDALONE VIRTUAL MACHINE and enter a unique DNS NAME for this VM.

It is to note that, when we create a VM with Standalone Virtual Machine option, there will be a cloud service created automatically for that VM. So this enables us to access the VM using the DNS url or the IP Address of the machine.

When we create VM with Connect to an Existing Virtual Machine, it will sit under the cloud service created for the existing virtual machine and can be accessible though connected machine url one. There can be only one endpoint can be exposed across all the VMs under the same cloud service.

I am not planning to host any application in this VM, but planning to install DNS and AD on this machine. So I am selecting Standalone Virtual Machine.

Select the Storage Account name for storing the Image and Disk files. Incase if you are not planned to store the files under a particular storage account, let Azure generate a new storage account on its own for this VM and store it by selecting Use an automatically generated storage account. But better to store all the files under a dedicated storage account.

For the REGION/AFFINITY GROUP/VIRTUAL NETWORK dropdown, select the VPN name created in the previous post. The VPN name will be under the Virtual Networks section.


By selecting VPN name, the VIRTUAL NETWORK SUBNETS dropdown will appear. Select the DNSSubnet and press Next.


Step 5: Select None in the AVAILABILITY SET and press OK.

The availability set can be used when more than one server for the same service and each server required sitting under different rack. So the servers, network connection, power etc. will be physically separated and if one rack failed, the other servers in other rack will respond to the request. We will use availability set when creating database servers and web servers.


Azure will create the VM and show in the VM list.

Creating the Azure VM under the VPN using PowerShell script

Below script can be used to create the VM same as we created from the Management Portal just before.

Set-AzureSubscription -SubscriptionName "Subscription-1 Introductory special" -CurrentStorageAccount azurevpntest

# Defining variable for password
$pass = 'password@123'

# Defining Image name
$W2K12 = 'MSFT__Windows-Server-2012-Datacenter-201210.01-en.us-30GB.vhd'

# Defining New VM Configuration
$DNSVM = New-AzureVMConfig -Name 'DNTDNSVM' -InstanceSize Small -ImageName $W2K12 |
    Add-AzureProvisioningConfig -Windows -Password $pass |
 Set-AzureSubnet -SubnetNames 'DNSSubnet'

# Creating VM
New-AzureVM -ServiceName 'DNTDNSService' -VMs $DNSVM -VNetName 'DNTVPN' -AffinityGroup 'DNTAG'


Once the request submitted to Azure, it will provision the VM and show in the Virtual Machine list.


In this post, we created the VM under the Azure VPN which was created in the first post. From next post, we will install Active Directory in this VM and create others VMs and install necessary software for our POC.


0 Responses to “Creating VPN and Hosting Web application on Azure - Part 2”

Post a Comment