Microsoft Azure IaaS, or “Infrastructure-as-a-Service,” allows you to host virtual machines in Microsoft Azure. The IaaS offering provides the virtualization layer that runs hundreds of Hyper-V clusters in Microsoft datacenters located around the world.
To create a virtual machine in Azure, all you need to do is click on the New > Compute > Virtual Machine > From Gallery and then create the virtual machine by selecting a syspreped image from Azure gallery. Once the virtual machine is created, Azure will host the virtual machine on one of the Hyper-V clusters running in one of the Microsoft datacenters.
At first glance, it might look very easy to set up a virtual machine in Azure, but there are several things you need to take into consideration before creating a virtual machine in Azure as listed below.
- You need to ensure there are no network latency issues when an application or users connect to the virtual machines hosted in Azure. For example, if all your users reside in the Eastern US region, you would want to host Azure virtual machines in the Eastern US region rather than hosting virtual machines in Western US or any other Azure regions which, in turn, might cause network latency issues.
- You also need to ensure there are no performance issues or potential increases in data transfer cost. For example, hosting virtual machines in the North Central US Azure region and hosting a storage account that holds virtual machine files in the South Central US Azure region might decrease overall performance of the virtual machines and increase the data transfer costs.
- Before creating Azure virtual machines, you will also need to ensure you have created Azure virtual networks, which in turn helps you deploy virtual machines on different IP subnets and also helps in providing connectivity to on-premises networks. Note that you cannot assign an Azure virtual network to existing Azure virtual machines. In cases where you need to assign an Azure virtual network to an existing Azure VM, you must first delete the VM without deleting the virtual hard disk files and then re-create the VM.
- Similarly, you also need to ensure you have created a storage account that will be used by Azure to store virtual machine files such as VM configuration and virtual hard disk files. The virtual machine files are stored on LUNs that are attached to the Hyper-V clusters running in an Azure datacenter. Although Azure can create a storage account automatically when creating a virtual machine, creating a storage account beforehand will help you manage things properly.
To eliminate network latency and minimize data transfer costs, you will need to ensure your virtual machines and associated components are deployed in the same Azure region rather than spreading resources across multiple Azure regions.
You can create an Affinity Group in Azure that contains the name of the Azure region and then select the Affinity Group while creating an Azure virtual machine, but an Affinity Group cannot help you if you need to attach VMs to an Azure virtual network.
This is because when you create a virtual machine in Azure, you are asked to select the Region / Affinity Group or Azure Virtual Network. You can only select either Region, Affinity Group or a Virtual Network on the “Create a Virtual Machine” page as shown in the screenshot below.
If you have already created both an Affinity Group and an Azure virtual network, you might be questioning why the “Create A Virtual Machine” page does not allow you to select both of them.
Since the overall objective is to ensure that virtual machines and their associated components are placed in the same Azure region and since you can specify an Azure region name while creating an Azure virtual network, the use of an Affinity Group does not pay much importance in the case of Azure virtual machines.
Whether to create an Affinity Group for Azure virtual machines or not depends on a couple of factors:
- If you need to deploy virtual machines with different IP subnets or if you require connectivity between on-premises and Azure virtual machines, you would need to create an Azure virtual network with the Azure region name and then select the Azure virtual network when creating a virtual machine.
- If you are deploying virtual machines on Azure that will not need to connect to an Azure virtual network, you can select either Affinity Group or an Azure region name from the list.
You can create a storage account using the Azure portal. All you need to do is specify the storage account name and then select either the Affinity Group name or the Azure region name. Once created, select the storage account when creating the virtual machine in Azure as shown in the screenshot below.
To summarize, Azure provides Affinity Groups to help you group resources in one cloud container and then be able to deploy cloud containers to an Azure region specified in the Affinity Group, but when it comes to attaching an Azure virtual network to Azure VMs, Affinity Groups do not play a major role.
Nirmal Sharma is a MCSEx3, MCITP and Microsoft MVP in Directory Services. He has specialized in Microsoft Technologies since 1994 and has followed the progression of Microsoft Operating System and software. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to Solution IDs for www.Dynamic-SpotAction.com. Nirmal can be reached at email@example.com.