Availability sets for redundancy in Azure - Commands & Configuration
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Compute/availabilitySets",
"apiVersion": "2022-03-01",
"name": "myAvailabilitySet",
"location": "eastus",
"properties": {
"platformFaultDomainCount": 2,
"platformUpdateDomainCount": 5
},
"sku": {
"name": "Aligned"
}
}
]
}This JSON file is an Azure Resource Manager (ARM) template that creates an availability set named myAvailabilitySet in the eastus region.
platformFaultDomainCount sets how many separate physical racks your servers will be spread across to avoid hardware failures affecting all at once.
platformUpdateDomainCount sets how many groups your servers are divided into for updates, so not all update at the same time.
The sku with value Aligned means it uses the latest Azure infrastructure for availability sets.
az group create --name myResourceGroup --location eastus
--name - Sets the name of the resource group.--location - Specifies the Azure region for the resource group.az deployment group create --resource-group myResourceGroup --template-file availability-set.json
--resource-group - Specifies the resource group where the deployment happens.--template-file - Points to the ARM template file to deploy.az vm create --resource-group myResourceGroup --name myVM1 --image UbuntuLTS --availability-set myAvailabilitySet --admin-username azureuser --generate-ssh-keys
--availability-set - Assigns the VM to the availability set for redundancy.--generate-ssh-keys - Automatically creates SSH keys for secure login.az vm list --resource-group myResourceGroup --show-details --output table
--show-details - Shows extra info like power state and IP addresses.--output - Formats the output as a readable table.If you remember nothing else from this pattern, remember: availability sets keep your app running by spreading servers across different physical and update groups to avoid single points of failure.
Practice
Availability Set in Azure?Solution
Step 1: Understand the role of Availability Sets
Availability sets distribute VMs across different physical hardware to avoid single points of failure.Step 2: Identify the correct purpose
This distribution helps keep apps running during hardware failures by using fault domains.Final Answer:
To keep virtual machines running during hardware failures by spreading them across fault domains -> Option BQuick Check:
Availability sets = fault domain distribution [OK]
- Confusing availability sets with backup solutions
- Thinking availability sets increase storage
- Assuming availability sets reduce VM costs
Solution
Step 1: Recall Azure CLI syntax for availability sets
The correct command usesaz vm availability-set createwith parameters for fault and update domain counts.Step 2: Match the correct command
az vm availability-set create --name MySet --resource-group MyGroup --platform-fault-domain-count 2 --platform-update-domain-count 5 matches the correct syntax and parameter names exactly.Final Answer:
az vm availability-set create --name MySet --resource-group MyGroup --platform-fault-domain-count 2 --platform-update-domain-count 5 -> Option AQuick Check:
Correct CLI syntax = az vm availability-set create --name MySet --resource-group MyGroup --platform-fault-domain-count 2 --platform-update-domain-count 5 [OK]
- Using wrong command group like 'az availability-set create'
- Incorrect parameter names like 'faults' or 'updates'
- Mixing VM creation command with availability set creation
Solution
Step 1: Understand update domains in availability sets
Update domains define groups of VMs rebooted one group at a time during planned maintenance.Step 2: Apply update domain behavior
Only VMs in the affected update domain reboot; others continue running.Final Answer:
Only VMs in update domain 3 are rebooted; others keep running -> Option DQuick Check:
Update domain reboot = only affected domain [OK]
- Confusing fault domains with update domains
- Assuming all VMs reboot together
- Thinking fault domain 3 is rebooted on update domain maintenance
Solution
Step 1: Understand VM placement without availability sets
Without an availability set, Azure may place VMs on the same physical hardware.Step 2: Identify impact on redundancy
This increases risk that a hardware failure affects both VMs, causing downtime.Final Answer:
The VMs may be placed on the same hardware, increasing downtime risk -> Option AQuick Check:
No availability set = no guaranteed hardware separation [OK]
- Assuming Azure auto-creates availability sets
- Thinking VMs won't start without availability sets
- Confusing availability sets with backup features
Solution
Step 1: Understand fault domain distribution
Fault domains separate VMs across different hardware racks to avoid single points of failure.Step 2: Understand update domain distribution
Update domains ensure VMs reboot in groups during maintenance, so spreading VMs across them reduces downtime.Step 3: Apply best practice for VM distribution
Distributing VMs evenly across fault domains and update domains maximizes redundancy and availability.Final Answer:
Place 3 VMs in fault domain 1 and 3 VMs in fault domain 2, spread evenly across update domains -> Option CQuick Check:
Even VM spread across fault and update domains = max redundancy [OK]
- Putting all VMs in one fault domain
- Ignoring update domain distribution
- Assuming same update domain reduces reboots
Ready to prove it?
Pass the test and this pattern moves unknown
