Symptoms
- Azure VM deployment or resize fails with error:
AllocationFailedorAllocation failed. We do not have sufficient capacity for the requested VM size in this region. - The error occurs during new VM creation, starting a deallocated VM, or resizing an existing VM.
Root Cause
Azure does not guarantee capacity for all VM sizes in all regions at all times. The AllocationFailed error occurs when the Azure region or availability zone lacks sufficient physical compute resources (CPU, memory, GPU) to fulfill the VM request at that moment. This is a transient capacity constraint, not a configuration or quota issue.
Resolution (Step-by-Step)
-
Retry the deployment immediately. Capacity can free up quickly.
az vm create --resource-group <rg> --name <vm> --image Ubuntu2204 --admin-username azureuser --generate-ssh-keys -
Deploy to a different availability zone within the same region.
az vm create --resource-group <rg> --name <vm> --image Ubuntu2204 --zone 2 --admin-username azureuser --generate-ssh-keys -
Try a different VM size in the same family (e.g., Standard_D2s_v3 instead of Standard_D2_v3) or a different family (e.g., Standard_B2s).
az vm create --resource-group <rg> --name <vm> --image Ubuntu2204 --size Standard_D2s_v3 --admin-username azureuser --generate-ssh-keys -
Deploy to a different region with available capacity.
az vm create --resource-group <rg> --name <vm> --image Ubuntu2204 --location eastus2 --admin-username azureuser --generate-ssh-keys -
Use an Azure Reserved VM Instance or Capacity Reservation to guarantee capacity for future deployments.
az capacity reservation group create --resource-group <rg> --name <reservation-group> --location eastus az capacity reservation create --resource-group <rg> --capacity-reservation-group <reservation-group> --name <reservation> --sku Standard_D2s_v3 --capacity 1 -
Deploy using an Azure Resource Manager (ARM) template with
availabilityZonesorplatformFaultDomainsettings to spread across fault domains.
Verification
Confirm the VM is running and healthy:
az vm show --resource-group <rg> --name <vm> --query "provisioningState" -o tsv
Expected output: Succeeded