Bird
Raised Fist0
Azurecloud~5 mins

VM pricing models in Azure - Commands & Configuration

Choose your learning style10 modes available
Introduction
Choosing the right pricing model for virtual machines helps you save money and match your usage needs. Azure offers different ways to pay for VMs depending on how long and how often you use them.
When you want to run a VM for a short test or development and pay only while it runs.
When you plan to run a VM continuously for months and want a lower price by committing upfront.
When you need flexibility to start and stop VMs without long-term commitment.
When you want to save money by reserving VMs for one or three years.
When you want to pay only for the compute time without managing VM infrastructure.
Commands
This command lists available VM sizes and pricing options in the East US region so you can choose the right VM type and pricing model.
Terminal
az vm list-skus --location eastus --output table
Expected OutputExpected
Name Tier Size Family Location Restrictions Standard_B1s Basic Standard_B1s B-series eastus None Standard_D2s_v3 Standard Standard_D2s_v3 D-series eastus None Standard_F4s Standard Standard_F4s F-series eastus None
→
--location - Specifies the Azure region to list VM SKUs
→
--output - Formats the output as a readable table
This command creates a new VM with a pay-as-you-go pricing model, which means you pay only for the time the VM runs without upfront commitment.
Terminal
az vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --size Standard_B1s --generate-ssh-keys
Expected OutputExpected
{ "fqdns": "", "id": "/subscriptions/xxxx/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM", "location": "eastus", "name": "myVM", "powerState": "VM running", "resourceGroup": "myResourceGroup", "zones": null }
→
--resource-group - Specifies the resource group to create the VM in
→
--size - Specifies the VM size which affects pricing
→
--generate-ssh-keys - Automatically creates SSH keys for secure login
This command creates a one-year reserved instance for the Standard_B1s VM, which lowers the hourly cost by committing to use the VM for one year.
Terminal
az reservations reservation create --name myReservation --sku Standard_B1s --location eastus --quantity 1 --term P1Y
Expected OutputExpected
{ "id": "/subscriptions/xxxx/providers/Microsoft.Capacity/reservationOrders/xxxx/reservations/myReservation", "name": "myReservation", "sku": "Standard_B1s", "term": "P1Y", "location": "eastus", "quantity": 1 }
→
--sku - Specifies the VM size for the reservation
→
--term - Specifies the reservation length, e.g., P1Y for one year
→
--quantity - Number of reserved instances to purchase
This command lists all VMs in the resource group with details including power state and pricing model to verify your VM status and billing type.
Terminal
az vm list --resource-group myResourceGroup --show-details --output table
Expected OutputExpected
Name ResourceGroup Location PowerState VMId myVM myResourceGroup eastus VM running xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
→
--show-details - Shows extra info like power state
→
--output - Formats output as a table for easy reading
Key Concept

If you remember nothing else from this pattern, remember: Azure VM pricing models let you choose between paying only for what you use or saving money by committing to longer use.

Common Mistakes
Trying to reserve a VM size that is not available in the chosen region
Reservations only work for VM sizes available in the region, so the command fails or reservation is not applied.
Use 'az vm list-skus' to check available VM sizes in the region before creating a reservation.
Assuming pay-as-you-go VMs stop billing when the VM is deallocated but not deleted
Billing continues for allocated resources like storage even if the VM is stopped but not deallocated.
Stop and deallocate the VM to stop compute charges when not in use.
Summary
Use 'az vm list-skus' to find VM sizes and pricing options in your region.
Create VMs with 'az vm create' to use pay-as-you-go pricing for flexible usage.
Reserve VMs with 'az reservations reservation create' to save money by committing to long-term use.
Check VM status and pricing details with 'az vm list --show-details'.

Practice

(1/5)
1. Which Azure VM pricing model allows you to pay only for the time you use without any long-term commitment?
easy
A. Spot VMs
B. Reserved Instances
C. Hybrid Benefit
D. Pay-as-you-go

Solution

  1. Step 1: Understand Pay-as-you-go model

    This model charges you based on actual usage with no upfront commitment.
  2. Step 2: Compare with other models

    Reserved Instances require upfront commitment, Spot VMs can be interrupted, Hybrid Benefit is a discount on licenses.
  3. Final Answer:

    Pay-as-you-go -> Option D
  4. Quick Check:

    Flexible payment without commitment = Pay-as-you-go [OK]
Hint: Pay only for what you use with no upfront cost [OK]
Common Mistakes:
  • Confusing Reserved Instances with Pay-as-you-go
  • Thinking Spot VMs are always available
  • Mixing Hybrid Benefit with pricing models
2. Which of the following is the correct description of Spot VMs in Azure?
easy
A. VMs that offer the lowest price but can be evicted anytime
B. VMs with a fixed monthly cost and no interruptions
C. VMs reserved for one year with upfront payment
D. VMs that use existing licenses for cost savings

Solution

  1. Step 1: Identify Spot VMs characteristics

    Spot VMs provide the lowest price but can be interrupted or evicted when Azure needs capacity.
  2. Step 2: Eliminate other options

    Fixed monthly cost applies to Reserved Instances, upfront payment is for Reserved Instances, license reuse is Hybrid Benefit.
  3. Final Answer:

    VMs that offer the lowest price but can be evicted anytime -> Option A
  4. Quick Check:

    Lowest cost but interruptible = Spot VMs [OK]
Hint: Spot VMs are cheap but can be stopped anytime [OK]
Common Mistakes:
  • Assuming Spot VMs have fixed pricing
  • Confusing Spot VMs with Reserved Instances
  • Thinking Hybrid Benefit applies to Spot VMs
3. Consider you have a workload that runs continuously for 3 years. Which pricing model will most likely save you the most money?
medium
A. Pay-as-you-go
B. Reserved Instances
C. Hybrid Benefit
D. Spot VMs

Solution

  1. Step 1: Analyze workload duration

    A continuous 3-year workload benefits from long-term commitment discounts.
  2. Step 2: Match pricing model to workload

    Reserved Instances offer significant savings for long-term use compared to Pay-as-you-go or Spot VMs.
  3. Final Answer:

    Reserved Instances -> Option B
  4. Quick Check:

    Long-term continuous use = Reserved Instances [OK]
Hint: Long-term use? Choose Reserved Instances [OK]
Common Mistakes:
  • Choosing Pay-as-you-go for long-term workloads
  • Selecting Spot VMs for continuous workloads
  • Confusing Hybrid Benefit with pricing model alone
4. You tried to deploy a Spot VM but it was evicted unexpectedly. What is the most likely reason?
medium
A. Azure needed the capacity and reclaimed the Spot VM
B. You exceeded your reserved instance quota
C. You did not apply Hybrid Benefit correctly
D. Your Pay-as-you-go subscription expired

Solution

  1. Step 1: Understand Spot VM eviction

    Spot VMs can be evicted anytime Azure needs capacity for other workloads.
  2. Step 2: Rule out other causes

    Reserved instance quota does not affect Spot VMs, Hybrid Benefit is unrelated to eviction, subscription expiration stops all VMs.
  3. Final Answer:

    Azure needed the capacity and reclaimed the Spot VM -> Option A
  4. Quick Check:

    Spot VM eviction = Azure capacity needs [OK]
Hint: Spot VMs can be stopped anytime Azure needs space [OK]
Common Mistakes:
  • Blaming reserved instance quota for Spot eviction
  • Thinking Hybrid Benefit prevents eviction
  • Assuming subscription expiration causes eviction only
5. You want to run a batch job that can tolerate interruptions and save the most money. Which Azure VM pricing model should you choose and why?
hard
A. Reserved Instances because they offer the lowest price for long-term use
B. Pay-as-you-go because it offers flexibility without upfront cost
C. Spot VMs because they offer the lowest price but can be interrupted
D. Hybrid Benefit because it uses existing licenses to reduce cost

Solution

  1. Step 1: Identify workload tolerance

    The batch job can handle interruptions, so a pricing model with possible evictions is acceptable.
  2. Step 2: Match pricing model to workload needs

    Spot VMs offer the lowest price but can be interrupted, fitting the batch job's tolerance and cost-saving goal.
  3. Step 3: Eliminate other options

    Reserved Instances are for long-term steady use, Pay-as-you-go is flexible but more expensive, Hybrid Benefit reduces license cost but not VM price.
  4. Final Answer:

    Spot VMs because they offer the lowest price but can be interrupted -> Option C
  5. Quick Check:

    Interruptible and cheap = Spot VMs [OK]
Hint: Interruptible jobs? Choose Spot VMs for best savings [OK]
Common Mistakes:
  • Choosing Reserved Instances for interruptible jobs
  • Confusing Hybrid Benefit with pricing model
  • Ignoring interruption tolerance in choice
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard