Please see the detailed steps to configure it:
- Go to your Azure Portal and click on Virtual Machines.
- Select the Virtual Machine that you need to start/stop.
- Select Tags and then you add a name and a value for the tag. For example, Name: Start Value:
7:00AM and click save, then add another tag to stop, for example, Name: Stop Value: 5:00PM. Add the same Tags to all the computers you want to Start/Stop.
- Copy the tag names and values in one note, you will need that information to configure the runbook.
- Go to your Automation Account.
- Click on Runbooks Gallery. If filter window appears just click ok.
7. Click on “Shutdown/Start VMs by tag”
- Click on “Import”.
- Type a Name to the Runbook and click ok:
- Click on “Edit”:
11. Click on “Publish” and then click on “yes”
12. Click on “Schedule”
- Click on Schedule, Create a new schedule, type a name and then configure the schedule as following image, you can make it recurring and selecting Week you can select only the desired days to start the VMs.
- Click on “Create” (Screenshot on next page)
15. Click on “Parameters and run settings”
16. Add the Tag Name and Tag Value that you already added to the VM to Start. Example: TagName: Start TagValue:7:00AM.
17. Shutdown: if you select False then the VM will Start. If you select True the VM will stop.
- Click OK.
19. Click “OK” again
The runbook is now created and It will start all the VMs that are tagged with the name and value you selected.
Now you just need to create the runbook to stop the VMs at desire time.
To create the runbook to stop the VM you just need to follow the same steps, but using the Tag Name and Value that you defined to Stop, for example: Tag Name: Stop Value: 5:00PM and Shutdown: True to stop the VM.
The advantage of use these runbooks is that if you need to add more VMs to start and stop, you just need to add the Tag Name and Value to the desired VM and it will be automatically added to the runbook scope.