0
0
Azurecloud~5 mins

Azure global infrastructure (regions, availability zones) - Commands & Configuration

Choose your learning style9 modes available
Introduction
Azure global infrastructure is a network of data centers around the world. It helps keep your apps running smoothly by placing resources close to users and protecting them from failures.
When you want your app to respond quickly to users in different countries by placing resources nearby.
When you need to keep your app running even if one data center has a problem.
When you want to store data in a specific country to follow local rules.
When you want to spread your app across multiple locations to handle more users.
When you want to back up your app in a different place to avoid losing data.
Commands
This command lists all Azure regions where you can create resources. It helps you see the available locations worldwide.
Terminal
az account list-locations --output table
Expected OutputExpected
Name DisplayName -------------------- ------------------------- eastus East US westus West US westeurope West Europe southeastasia Southeast Asia japaneast Japan East ... ...
--output table - Shows the output in a readable table format
This command shows the available virtual machine sizes in the East US region. It helps you pick the right machine type near your users.
Terminal
az vm list-skus --location eastus --size Standard_DS1_v2 --output table
Expected OutputExpected
Name Tier Size Family ---------------- ------ ------------- -------- Standard_DS1_v2 Standard Standard_DS1_v2 DSv2-Series
--location - Specifies the region to check
--size - Filters by VM size
--output table - Shows output in table format
This command creates an availability set in East US to spread virtual machines across fault and update domains. It helps keep your app running during hardware or software updates.
Terminal
az vm availability-set create --name myAvailabilitySet --resource-group myResourceGroup --location eastus --platform-fault-domain-count 2 --platform-update-domain-count 5
Expected OutputExpected
{ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/myAvailabilitySet", "location": "eastus", "name": "myAvailabilitySet", "platformFaultDomainCount": 2, "platformUpdateDomainCount": 5, "provisioningState": "Succeeded", "resourceGroup": "myResourceGroup", "type": "Microsoft.Compute/availabilitySets" }
--platform-fault-domain-count - Number of fault domains to spread VMs across
--platform-update-domain-count - Number of update domains to spread VMs across
This command creates a virtual machine in the East US region inside the availability set. It ensures the VM benefits from high availability.
Terminal
az vm create --resource-group myResourceGroup --name myVM1 --image UbuntuLTS --availability-set myAvailabilitySet --location eastus --admin-username azureuser --generate-ssh-keys
Expected OutputExpected
{ "fqdns": "", "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM1", "location": "eastus", "name": "myVM1", "powerState": "VM running", "resourceGroup": "myResourceGroup", "zones": null }
--availability-set - Assigns the VM to the availability set
--generate-ssh-keys - Creates SSH keys for secure login
This command lists all virtual machines in the resource group to verify the VM creation and its availability set assignment.
Terminal
az vm list --resource-group myResourceGroup --output table
Expected OutputExpected
Name ResourceGroup Location PowerState Zones ------ --------------- ---------- ------------ ----- myVM1 myResourceGroup eastus VM running
--output table - Shows output in a readable table
Key Concept

If you remember nothing else from this pattern, remember: Azure regions are physical locations worldwide, and availability zones or sets help keep your apps running by spreading resources across separate hardware.

Common Mistakes
Trying to create resources in a region that does not support the chosen service or VM size.
Azure will return an error because the resource is not available in that region.
Use 'az account list-locations' and 'az vm list-skus' to check availability before creating resources.
Not assigning VMs to an availability set or zone when high availability is needed.
VMs may be placed on the same hardware, causing downtime if that hardware fails.
Create and assign VMs to availability sets or zones to spread risk.
Summary
Use 'az account list-locations' to find Azure regions worldwide.
Create availability sets to spread VMs across fault and update domains for reliability.
Assign VMs to availability sets during creation to ensure high availability.
Verify VM creation and placement with 'az vm list'.