Microsoft has several regional datacenters for hosting Azure IaaS. There are two on the west coast, two on the east coast and two each in Europe and Asia. When you create a VM you are required to select a region, at minimum, where your VM will be located. If you just go with a regional selection, you leave it up to the Azure fabric to control where your machine is placed.
For more granular control, you have two other components you need to take advantage of – Affinity Groups and Availability Sets.
By creating an affinity group, you are giving the Azure fabric some additional logic to keep your VMs physically closer together within the datacenter. This might be important if you are hosting an application or service that has multiple server components and you want them to closer together to reduce any potential latency across the internal network.
To create an affinity group, you provide a name and create a network that is associated with it. Then all the VMs added to that affinity group also will be given addressing from the associated virtual network. Affinity groups are created in your Azure settings area.
Having your servers close together in the physical fabric is good, but being TOO close could be bad. For high availability, you’ll also want to make sure that your servers aren’t all on the same rack or within the same fault domain in the datacenter. If a whole rack goes down due to a hardware issue, you wouldn’t want an entire cloud service to go with it.
That’s where “Availability Sets” come in. An “availability set” allows you to define a group of servers that perform the same role and Windows Azure separates them across fault domains and ensures that at least one of them is always available.
You can set up availability sets in two places: within the autoscale properties for a cloud services (as they are required for autoscale to function), or from the configuration settings of an individual server.
Close, but not too close. Perfect!