In the past when we were deploying SharePoint farm on Azure Iaas we used to create an affinity group firstly then we were attaching any new created resources for our farm to the same affinity group (Storage account – Virtual Network – etc… ) and by that affinity group will let Window Azure know you wish to keep these resources located together within the same Azure regional datacenter and this off course will minimize the latency for your SharePoint farm.
But now with the introduction to the new regional network concept in Azure you can’t do that through the Azure portal UI.
What is Regional Virtual Networks
Here is its description in MS words:
”VNets were bound to a scale unit, more precisely an Affinity group. An Affinity group is a grouping concept that references to a section of the datacenter or in other words certain number of servers. Since a VNet was bound to an affinity group it was indirectly bound to a set of servers, and hence was not able to place deployments in servers outside of this scale unit. But with Regional Virtual Networks, these restrictions are removed, since the scope of the Virtual Network is the entire region and not just an Affinity group.
Following are the key scenarios enabled by Regional Virtual Networks:
- New VM Sizes like A8 and A9 can be deployed into a virtual network which can also contain other sizes.
- New features like Reserved IPs, Internal load balancing, Instance level Public IPs
- The Virtual Network can scale seamlessly to use the capacity in the entire region, but we still restrict to maximum of 2048 virtual machines in a VNet.
- You are not required to create an affinity group before creating a virtual network.
- Deployments going into a VNet does not have to be in the same affinity group.”
This is great but now you can’t enforce that all your VMs go close in the same datacenter as today if you added your VM to an affinity group when you created it you can’t attach it to VNet. so what is the solution ?!
PowerShell is the solution
So to fix this problem we need to create all the farm VMs using PowerShell as this is the only option today to attached a VM to an affinity group and a VNet.
Please note that The affinity group and the regional virtual network must be on the same region.
New-AzureVM –ServiceName ‘ServiceName’ -AffinityGroup ‘AffinityGroupName’ -VNetName ‘VNETName’