Virtual machine Auto shutdown based on schedule using ARM Template?

Dnyaneshwar Surywanshi 156 Reputation points
2021-03-10T06:56:00.613+00:00

I want to enable Auto-shutdown for virtual machine with scheduled time using ARM template so if there are any way please provide me any custom ARm template or links.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,205 questions
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,461 Reputation points Microsoft Employee
    2021-03-10T23:07:55.857+00:00

    @Dnyaneshwar Surywanshi
    Thank you for your post!

    When it comes to getting an ARM template for auto-shutdown you can easily do this by:

    1. Creating a new VM
    2. Enabling Auto-Shutdown with your required specifications
    3. Download a template for automation

    Auto-Shutdown ARM template
    76492-auto-shutdownarmtemplate.gif

    {  
        "name": "[concat('shutdown-computevm-', parameters('virtualMachineName'))]",  
        "type": "Microsoft.DevTestLab/schedules",  
        "apiVersion": "2017-04-26-preview",  
        "location": "[parameters('location')]",  
        "dependsOn": [  
            "[concat('Microsoft.Compute/virtualMachines/', parameters('virtualMachineName'))]"  
        ],  
        "properties": {  
            "status": "[parameters('autoShutdownStatus')]",  
            "taskType": "ComputeVmShutdownTask",  
            "dailyRecurrence": {  
                "time": "[parameters('autoShutdownTime')]"  
            },  
            "timeZoneId": "[parameters('autoShutdownTimeZone')]",  
            "targetResourceId": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]",  
            "notificationSettings": {  
                "status": "[parameters('autoShutdownNotificationStatus')]",  
                "notificationLocale": "[parameters('autoShutdownNotificationLocale')]",  
                "timeInMinutes": "30",  
                "emailRecipient": "[parameters('autoShutdownNotificationEmail')]"  
            }  
        }  
    }  
    

    If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful