Azure DevTest Lab is a service for easily creating, using, and managing infrastructure-as-a-service (IaaS) virtual machines (VMs) and platform-as-a-service (PaaS) environments in labs. Labs offer preconfigured bases and artifacts for creating VMs, and Azure Resource Manager (ARM) templates for creating environments like Azure Web Apps or SharePoint farms.
As per the above description about the service, DevTest lab provides better management capabilities w.r.t the workloads. You can create Artifacts and the configure your virtual machines for developers with required set of tools. Developers machines does not need to be up all the time.
When a developer finishes its testing the machine can be shutdown. For example: your company hired few developers to develop an application. Developers work every day and their working hours start from 9 AM – 5 PM. Outside the office hours, developers do not need their VMs. The VMs can be shutdown to save on compute costs.
Auto start and Auto shutdown feature is out of the box provided to you when you use Azure DevTest Lab service. You can configure the start time of the VM’s and also configure the days when the VM’s should be started. For example: If no one would be using the developer virtual machines on saturday and sunday then you can configure auto start schedule to not start the VMs over the weekend.
In this blog post, we will see how to configure auto start of an Azure Virtual Machine.
Login on Microsoft Azure portal using https://portal.azure.com link.
If you have already created a Azure DevTest Lab service then you can use Configuration Settings of the service to configure Auto Start and Auto Shutdown schedules. You will first have to Configure auto-start at DevTest Lab Service Level and then you can enable it for each individual virtual machine. Auto-Start schedule can only be configured at DevTest Lab Service level which will apply to all the virtual machines. At VM level you just need to enable Auto-Start. Let’s see the steps to configure it.
Click on Devtest Lab Service which you have created in Azure and then Select Configuration and policies under settings.
From Configuration and policies page, Scroll down to find Schedules and then click on Auto-start. Auto-start allows you to automatically start virtual machines in a lab at a scheduled time each day. So you can configure following settings to Allow Auto-start of the VM’s. When you configure auto-start from configuration and policies, you are just allowing auto-start and configuring a schedule. This will not apply to virtual machines. You will also have to enable auto-start for each individual VM level as well.
- Allow auto-start: Yes
- Scheduled start: Set a particular time when you want the VM’s to power up automatically every day.
- Time zone: Set the time zone.
- Day of the Week: Select the days on which you apply this schedule.
Click on Save to save the auto-start schedule.
Once auto-start schedule is configured under devtest lab configuration and service. You will have to enable auto-start at Virtual Machine level as well. For Enabling or applying the auto-start schedule on a virtual machine. Please follow below steps:
- Click on DevTest Lab service
- Click on Virtual Machines and Select your Virtual Machine.
- On left hand side of the page, Find Auto-start under Operations.
Select Yes to Enable Virtual machine automatic restart. This setting will enable auto-start on this VM and the auto-start schedule which we have configured earlier from Configuration and service under DevTest lab service will be applicable. For example. In this case. This Virtual Machine will start everyday at 7:00 AM. This schedule will apply only from Monday to Friday.
Once you have configured and enabled Auto-start of Azure Virtual Machine. You also have the option to enable Auto-Shutdown of the VM. You can use both Auto start and Auto-shutdown settings to configure when you want the VMs to power Up and Power down at specific time. These are really powerful setting to save Virtual Machine Compute Cost.
To configure Auto shutdown settings of an Azure Virtual Machine in DevTest Lab. You can search for a Virtual Machine under your DevTest Lab service and then Find Auto-shutdown under Operations. I will not go into Auto shutdown settings in this blog post as its very similar to auto-shutdown settings of any Virtual Machine in Azure. You can find more information about it from below blog post.
Its highly recommended to configure auto start and auto shutdown settings of the developer machine or any virtual machine which you think will not be used all the time. Configure if on the DevTest Lab service level and enable auto start at each VM level. Combine it with Auto shutdown settings to make the most of it. This will make sure that your machines are powering up at a set time everyday and shutting down at a set time. This will save your VM compute cost and also reduce your monthly bill as well.