Last updated: May 2026
Azure Virtual Machines Beginner AZ-104 ⏱ 8 min read

Azure VM Auto-Shutdown

One of the easiest and most effective ways to reduce Azure VM costs is auto-shutdown. For dev, test, and learning VMs that don't need to run 24/7, auto-shutdown automatically deallocates the VM at a set time each day — stopping compute billing overnight. It's a simple feature that can cut your VM costs by 50–70% without any code changes.

What you'll learn What auto-shutdown does and doesn't do · Setting up auto-shutdown in the portal · Email notifications before shutdown · CLI configuration · Auto-start (scheduled start) · Cost savings calculation · Best practices for dev/test environments

What Auto-Shutdown Does

Auto-shutdown deallocates (not deletes) your VM at a scheduled time each day. Deallocating means:

  • ✅ Compute billing stops — you no longer pay for CPU/RAM
  • ✅ The VM, its OS disk, and data disks are preserved
  • ✅ The VM can be manually started again any time
  • ⚠️ Storage billing continues — you still pay for the disk(s)
  • ⚠️ Public IP may change if dynamic — use static IP if you need the same IP after restart
ℹ️
Deallocate vs Stop vs Delete Stop (OS shutdown) — The OS shuts down but the VM is still allocated on hardware. You still pay for compute!
Deallocate — The VM is removed from hardware. Compute billing stops. This is what auto-shutdown does.
Delete — VM and resources are permanently removed.

Setting Up via Azure Portal

  1. Go to your VM in the Azure Portal
  2. In the left menu, scroll to Operations → click Auto-shutdown
  3. Toggle Enabled to On
  4. Set the Scheduled shutdown time — e.g., 8:00 PM
  5. Set the Time zone — select your local timezone (e.g., India Standard Time)
  6. Optionally configure Notification — see next section
  7. Click Save
💡
Set It at VM Creation You can also enable auto-shutdown during VM creation — on the Management tab. This ensures you never forget to configure it on new dev/test VMs.

Shutdown Notifications

Auto-shutdown can send you an email or webhook notification 30 minutes before shutdown. This gives you time to save your work or delay the shutdown if you're still using the VM.

Email Notification

In the auto-shutdown settings, under Notification:

  • Enable Send notification before auto-shutdown
  • Enter your email address
  • Azure sends a warning email 30 minutes before shutdown

Webhook Notification

For automated systems, you can provide a webhook URL. Azure sends an HTTP POST to this URL before shutdown — useful for triggering automated save operations or alerting Slack/Teams channels.

Setting Up via CLI

Azure CLI Enable auto-shutdown at 8 PM IST daily
# Get the VM resource ID
VM_ID=$(az vm show \
  --resource-group myResourceGroup \
  --name myVM \
  --query id \
  --output tsv)

# Enable auto-shutdown at 20:00 (8 PM) in IST timezone
# Note: time is in UTC format for CLI — IST is UTC+5:30, so 8 PM IST = 14:30 UTC
az rest \
  --method put \
  --uri "https://management.azure.com/subscriptions/{sub-id}/resourceGroups/myResourceGroup/providers/microsoft.devtestlab/schedules/shutdown-computevm-myVM?api-version=2018-09-15" \
  --body '{
    "location": "centralindia",
    "properties": {
      "status": "Enabled",
      "taskType": "ComputeVmShutdownTask",
      "dailyRecurrence": {"time": "1430"},
      "timeZoneId": "India Standard Time",
      "targetResourceId": "'$VM_ID'"
    }
  }'
💡
Easier via Portal The CLI method for auto-shutdown uses the DevTest Labs API which is verbose. For day-to-day use, configuring auto-shutdown through the portal is much simpler.

Auto-Start (Scheduled Start)

Azure doesn't have a built-in "auto-start" equivalent to auto-shutdown. However, you can achieve scheduled starts using:

Option 1 — Azure Automation Runbook

Create an Azure Automation account with a PowerShell runbook that starts the VM. Schedule it to run at your desired start time.

PowerShell Runbook to start a VM
Connect-AzAccount -Identity  # Use managed identity
Start-AzVM \
  -ResourceGroupName "myResourceGroup" \
  -Name "myVM"

Option 2 — Azure Function (Timer Trigger)

Create an Azure Function with a timer trigger that calls the Azure REST API to start the VM at a specific time. Functions are free for the first 1 million executions per month.

Cost Savings Calculation

Let's calculate real savings for a typical dev VM:

ScenarioRunning Hours/MonthCost (B2s VM)
No auto-shutdown (24/7)730 hours~₹2,200
Auto-shutdown at 8 PM, start 8 AM (12 hrs/day)365 hours~₹1,100
Auto-shutdown at 6 PM, start 9 AM (9 hrs/day)270 hours~₹810
Auto-shutdown at 5 PM, start 9 AM (8 hrs/day)240 hours~₹720

Just by adding auto-shutdown at 6 PM and starting at 9 AM on workdays, you save roughly ₹1,390/month on a single B2s VM — over ₹16,000/year. For a team with 10 dev VMs, that's ₹1.6 lakh/year in savings.

Best Practices

  • Enable on all dev/test VMs by default — Make it a team policy, not optional
  • Set up email notifications — 30-minute warning prevents losing unsaved work
  • Use static public IPs for dev VMs — Dynamic IPs change after deallocation, which breaks SSH config and scripts
  • Never enable auto-shutdown on production VMs — Obvious, but worth stating
  • Configure during VM creation — Easier than remembering to add it after
  • Pair with Azure Policy — Enforce auto-shutdown on all VMs in dev/test resource groups automatically
💡
AZ-104 Exam Tip Know that auto-shutdown deallocates the VM (compute billing stops but disk billing continues), that it sends a 30-minute notification before shutdown, and that it's configured per VM under Operations → Auto-shutdown in the portal.
📝 Practice Questions
Click an option to check your answer. AZ-104 style questions.
Q1. What does Azure VM auto-shutdown actually do to the VM?
A Permanently deletes the VM and all its data
B Shuts down the OS but keeps the VM allocated on hardware
C Deallocates the VM — stops compute billing while preserving disks and config
D Pauses the VM in a suspended state
Q2. How far in advance does Azure send a notification before auto-shutdown?
A 5 minutes
B 30 minutes
C 1 hour
D 24 hours
Q3. After a VM is auto-shutdown (deallocated), which charges continue?
A Compute charges (CPU and RAM)
B Storage charges (OS disk and data disks)
C Network charges (data transfer)
D No charges of any kind
Q4. Where in the Azure Portal do you configure auto-shutdown for a VM?
A Monitoring → Alerts
B Operations → Auto-shutdown
C Settings → Configuration
D Automation → Runbooks
Q5. A developer's VM runs 8 hours per day (9 AM to 5 PM) instead of 24 hours. How much does this save compared to running 24/7?
A 25%
B 50%
C ~67%
D 90%
Comments
Disclaimer: RedKite Cloud is an independent educational resource and is not affiliated with, endorsed by, or officially connected to Microsoft Corporation. All product names, logos, and trademarks are property of their respective owners. Content is written independently for educational purposes only.