Auto shutdown Azure VMs

Auto shutdown Azure VMs

Q. Is there anything built in to Azure to automatically shutdown VMs at a certain time?

A. There are numerous solutions to automatically shutdown VMs:

  • Use an Azure Automation to shutdown whatever VMs are required and create a schedule to call the automation
  • Run a PowerShell script to scan for when VMs where shutdown by users (but still provisioned on the fabric and then shut them down (to stop paying) as I created at
  • Utilize the DevTestLabs schedule resource that will shutdown VMs at certain times with a configurable notification which is configured via JSON, e.g.:
  "$schema": "",
  "contentVersion": "",
  "parameters": {
    "vmName": {
      "type": "string"
  "variables": {
    "policyName": "[concat('shutdown-computevm-', parameters('vmName'))]",
    "vmResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('vmName'))]"
  "resources": [
      "apiVersion": "2016-05-15",
      "type": "Microsoft.DevTestLab/schedules",
      "name": "[variables('policyName')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "timeZoneId":"Central Standard Time",
  "outputs": {


Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.