Virtual machines in Windows Azure comes under as Infrastructure as a Service (IaaS). When we want to have complete control on our application deployment environment, then Azure Virtual Machine Service is a good option. Just like any other Cloud Services, Azure Virtual Machines can also be made Highly Available through configuration in Azure Management portal.
In this short tutorial I am going to show how to make VM Roles highly available within a Data Center. As an extension, we also see how to load balance the VMs using a load balance set endpoint. It is a step by step process, please perform below steps in order (as they mentioned).
Step 1 – Create a Virtual Machine in US-EAST Data Center. Select “Create from Gallery”

Select Windows Server 2012 R2 Data Center as Operation system. Click Next.

Enter a unique VM name and select the size of the VM. For simplicity sake, I have selected small size VM. Finally enter VM credentials and click next.

Enter the associate cloud service details like Data Center you want your VM to be created in, Cloud Service name for the VM etc. Important point is that we need to create an Availability Set for this VM. Later we use this availability set to make our VM highly available along with another Backup VM (we create that later in our tutorial).
As per MSDN, An availability set is a group of virtual machines that are deployed across fault domains and update domains. An availability set makes sure that your application is not affected by single points of failure, like the network switch or the power unit of a rack of servers.
A Fault domain is a group of server nodes which are connected through same power cable, network adapter etc., so in case of any power outage or network failure, all the servers in that connection will go down. On the other hand Update domain is the group of server nodes which are logically connected and all the server nodes will be updated with latest server patches at the same time. So in case of update domain if Microsoft releases a patch for a particular update domain, then all the nodes in that update domain will be updated at the same time.

In the next screen, have the default endpoints. Click Finish.

Step 2 – In the similar way create one more Virtual Machine with name – vmha2.
NOTE: While creating the second virtual machine, we have to make sure we select the already selected Cloud Service and Availability set (which are created while creating first virtual machine). Check below screen shot –

So created VMs will be listed as below –

Step 3 – Enable IIS for both the created VMs as shown in this resource.
NOTE – Do not create HTTP Endpoint from the below article. We create those endpoints in our next step.
Step 4 – Select vmha1 VM and then add HTTP 80 endpoint as shown below –
While adding HTTP 80 endpoint, we create a LoadBalance Set which acts as our load balancer. As per MSDN – load-balanced set can be used to distribute traffic across multiple virtual machines. Azure use Round robin algorithm to distribute traffic accordingly between Virtual machine cloud services.



Step 5 – Select vmha2 VM and then add HTTP 80 endpoint as shown below –


Step 6 – Testing -
Access vmha1.cloudapp.net from browser.
NOTE –
1. There can be sometime sporadic behavior of requests because of local DNS cache and browser cache on the client machine.
2. I made changes to the default IIS Site home page by including a text through which we can differentiate between VMs. So that we can clearly understand the differences that request routing is happening between 2 VMS.

And when you clear browser cache and refresh the page.

That proves load balancing.
Step 7 – Shutdown the vmha1 VM.

Now make the request to vmha1.cloudapp.net. Request will be served from vmha2.

With this we complete this tutorial. In my next tutorials, I am going to span the High availability concepts for Virtual machines across different data centers.
Stay tuned!!!






Pingback: TechNet Blogs()