Introduction
Developers can easily set lots of different rules, for example; the policy for the number of Virtual Machines per Lab user, which VM sizes are allowed for VM creation, the policy for Automate Shutdown of Virtual Machines and so on. Each policy also has a possibility to configure the threshold for it and to set alerts. By configuring and setting policies you can minimize your cost and reduce the waste.
Step 1: Allowed VM sizes policy
You can find all VM policies by going to settings in your account. The cost of Virtual Machine running is also connected to its size and all information about pricing for different sizes are available on Microsoft Azure’s Virtual Machines Pricing list, which is available on: https://azure.microsoft.com/en-us/pricing/details/virtual-machines/#Windows. Prices differ for Windows and Linux users; however, all information is accessible on the above link. Of course the larger the size of the Virtual Machine we choose, the higher the price will be.
- Click on the Settings button.
- On the right-hand side, a new column with all settings data will appear, from this list, select VM policies and click on policy Allowed VM sizes.
- First click on the Enable button, so that all options will be available for selection.
- From the list of all VM sizes, choose only the ones that should be allowed to use. You can do that by clicking in the square on the left size of the Virtual Machine size name.
- Click on the Save button to save selection.
- You will see that Policy has been saved.
Step 2: Maximum VM’s per user
The number of Virtual Machines that are linked to one user is directly connected to the cost of Virtual Machine in Microsoft Azure. In case that user tries to create a new VM, after the user limit has been reached, the error message will occur to the user, which will indicate that new VM cannot be created.
- Navigate back to VM policies tab and click on Maximum VMs per user policy.
- Click on Enable button, so that the typing window will be available.
- Type the number of VM’s allowed per user.
- Click on Save button.
- You will see that Policy has been saved.
Step 3: Total VM’s allowed
The final cost also depends on the total Virtual Machines in your Lab. In order to control that cost, you can set the maximum number of Virtual Machines that are allowed to be used in your Lab.
- Navigate back to VM policies tab and click on Total VM’s allowed.
- Click on the Enable button, so that the typing window will be available.
- Type the number of VM’s allowed in Lab.
- Click on Save button.
- You will see that Policy has been saved.
Step 4: Auto Shutdown policy
The final cost highly depends also on the working hours of all running Virtual Machines. This cost can be reduced whilst using Automate Shutdown for all Virtual Machines. This would mean that all Virtual Machines would be running only when this is really required. For example, if you don’t use all Virtual Machines at night, you can stop them at that time. This policy will automatically apply Automate Shutdown for all Virtual Machines.
- Navigate back to VM policies tab and click on Auto shutdown.
- Click on Enable button, so that the window with hours will be available.
- Choose the time when the Virtual Machine should stop.
- Click on Save button.
- You will see that Policy has been saved.
Conclusion
By setting policies for your needs, you can highly reduce the cost of Virtual Machine running. In one of our previous Microsoft Azure posts – Scheduled VM Shutdown with Azure Automation, we have already described how the usage of Virtual Machines with high configuration can be very expensive and how can you reduce the cost of Virtual Machines by reducing its working hours with Automated Shutdown. If you didn’t already consider creating Automate Shutdown with Azure, you should definitely consider doing so in DevTest Labs.