Configure Auto-shutdown for Azure Virtual Machines

Auto-shutdown helps reduce costs by automatically turning off virtual machines at a specified time. You can configure shutdown using the Azure portal, Azure CLI, PowerShell, or ARM templates.

Using the Azure Portal

  1. Navigate to Virtual machines and select the VM.
  2. In the left menu, choose Operations → Auto-shutdown.
  3. Enable the toggle, set the Shutdown time, Time zone, and optionally provide an Email notification address.
  4. Click Save.
Auto-shutdown settings in Azure portal

Using Azure CLI

az vm auto-shutdown \
  --resource-group MyResourceGroup \
  --name MyVM \
  --time 1900 \
  --time-zone "Pacific Standard Time" \
  --notification-email user@example.com

Replace MyResourceGroup, MyVM, and other parameters with your values.

Using PowerShell

Set-AzVMAutoShutdown -ResourceGroupName "MyResourceGroup" `
  -VMName "MyVM" `
  -Time "19:00" `
  -TimeZone "Pacific Standard Time" `
  -Email "user@example.com"

Using ARM Template

{
  "type": "Microsoft.DevTestLab/schedules",
  "name": "[concat(parameters('vmName'), '-shutdown')]",
  "apiVersion": "2018-09-01",
  "location": "[resourceGroup().location]",
  "properties": {
    "status": "Enabled",
    "taskType": "ComputeVmShutdownTask",
    "dailyRecurrence": {
      "time": "1900"
    },
    "timeZoneId": "Pacific Standard Time",
    "notificationSettings": {
      "status": "Enabled",
      "timeInMinutes": 30,
      "webhookUrl": ""
    }
  },
  "dependsOn": [
    "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]"
  ]
}

Quick Setup Demo