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.
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:
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 nirmal_sharma@mvps.org.
Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved
Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.