Azure Reserved Virtual Machine (VM) Instances offer significant cost savings (up to 72%) compared to pay-as-you-go pricing for long-running workloads. The common misconception is that you need to create new VMs to utilize reservations, but this isn't always true.
You can apply reservations to existing VMs through these methods:
# Azure CLI command to check reservation applicability
az vm list --query "[?storageProfile.osDisk.osType=='Windows'].{Name:name,Size:hardwareProfile.vmSize}" --output table
- Identify compatible VM sizes in your region
- Purchase reservation for matching VM series
- Apply reservation to existing VM
This script helps automate reservation application:
# PowerShell script to apply reservation
$vm = Get-AzVM -Name "YourVMName"
$reservation = Get-AzReservation -ReservationOrderId "your-order-id"
if ($vm.HardwareProfile.VmSize -eq $reservation.AppliedScopes) {
Set-AzReservation -ReservationOrderId $reservation.ReservationOrderId
-ReservationId $reservation.Id
-AppliedScopeType "Single"
-AppliedScope "/subscriptions/your-sub-id/resourceGroups/your-rg/providers/Microsoft.Compute/virtualMachines/your-vm"
}
- Reservations are size-flexible within the same VM series
- Regional vs. zonal reservations affect migration options
- Reservation sharing across subscriptions
Combine reservations with:
- Azure Hybrid Benefit for additional savings
- Spot instances for non-critical workloads
- Right-size recommendations from Azure Advisor
Azure Reserved Virtual Machine Instances (RIs) offer significant cost savings (up to 72% compared to pay-as-you-go pricing) for long-running workloads. Many developers initially deploy VMs using on-demand pricing, then later realize they could optimize costs by switching to reservations.
Good news - you don't need to rebuild your VM. Azure allows you to apply reservations to existing VMs through these methods:
# Azure CLI command to check VM size eligibility
az vm list-skus --location eastus --size Standard_D2 --output table
# PowerShell equivalent
Get-AzComputeResourceSku | where {
$_.Locations -Contains "eastus" -and $_.ResourceType -eq "virtualMachines"
}
- Identify your VM's characteristics (size, region, OS type)
- Purchase a matching reservation in Azure Portal
- Azure automatically applies the reservation to matching running VMs
After purchasing the reservation, verify its application:
# Check reservation utilization
az consumption reservation summary list --reservation-order-id [ORDER_ID]
# Alternative with PowerShell
Get-AzConsumptionReservationSummary -ReservationOrderId [ORDER_ID]
- Region mismatch between VM and reservation
- Different VM size series (e.g., Dv2 vs Dv3)
- Windows vs Linux OS type differences
For complex environments with many VMs, consider using Azure Policy to ensure reservations are properly utilized:
{
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Compute/virtualMachines"
},
{
"not": {
"field": "Microsoft.Compute/virtualMachines/sku.name",
"in": "[parameters('reservedInstanceSkus')]"
}
}
]
},
"then": {
"effect": "audit"
}
}