Microsoft Azure

Controlling Resource Usage and Costs in Azure DevTest Labs

In this post, I will show you how to configure DevTest Labs to control what can be deployed by testers and developers, how much of it they can deploy, and importantly, what the cost of the service will be.



Sponsored Content

Maximize Value from Microsoft Defender

In this ebook, you’ll learn why Red Canary’s platform and expertise bring you the highest possible value from your Microsoft Defender for Endpoint investment, deployment, or migration.

Configuration All Policies

All settings for an Azure DevTest Lab can be found in Settings > Configuration And Policies. Here you can perform many things, including but not limited to:

  • Cost monitoring and analysis
  • Control what virtual machine series/sizes can be deployed
  • Set up lab-wide or per-user quotas
  • Enable/configure auto-shutdown and/or auto-start
  • Define the available Marketplace and custom images

Allowed Virtual Machine Sizes

By default, all virtual machine sizes are allowed. If you enable Allowed Virtual Machine Sizes, you can limit the available series/size of virtual machines that devs/testers can deploy.

Limiting the series and size of virtual machines in Azure DevTest Labs [Image Credit: Aidan Finn]
Limiting the Series and Size of Virtual Machines in Azure DevTest Labs [Image Credit: Aidan Finn]

Virtual Machines Per User/Lab

The main cost of a DevTest Lab is the virtual machines that run in it, which are charged at the subscription’s normal virtual machine rates.

You can limit the number of machines that can be deployed in a DevTest Lab. This can be done per-user and/or per-lab. Both policies are enforced if you enable both and the lowest threshold will limit the users of the lab.

Both policies have identical settings:

  • Do you want to limit the number of virtual machines?
  • If so, what is the limit?
  • Do you want to limit how many machines can use Premium (SSD) Storage?
  • If so, how many Premium Storage-enabled machines should you allow?
Controlling how many virtual machines a user can have in Azure DevTest Labs [Image Credit: Aidan Finn]
Controlling How Many Virtual Machines a User Can Have in Azure DevTest Labs [Image Credit: Aidan Finn]

Auto-Shutdown and Auto-Start

An Azure customer only pays for virtual machines while the virtual machines are running. Performing a shutdown in the guest OS does not do an “Azure shutdown”. Note that other costs, such as storage, will still apply because they are not a part of the virtual machine runtime charge. You can minimize the costs of virtual machines by only running them at the required times.

You can automatically shut down virtual machines in several ways but Azure DevTest Labs allows you to configure a standard policy.

If you enable this policy, then the available settings are:

  • What time will virtual machines in the lab shut down start at?
  • What time zone is that time in?
  • Should you send a notification before the shutdown?
  • If so, do you want to trigger a webhook (external process via URI) or send an email?

Automatically shut down Azure DevTest Lab virtual machines [Image Credit: Aidan Finn]
Automatically Shut Down Azure DevTest Lab Virtual Machines [Image Credit: Aidan Finn]

You might, but don’t have to, couple this by automatically starting virtual machines in the lab. If you do enable this policy then you can specify:

  • The time of day the startups will begin
  • What time zone you are working in
  • What days of the week you want the lab virtual machines to start up on
Automatically start Azure DevTest Lab virtual machines [Image Credit: Aidan Finn]
Automatically Start Azure DevTest Lab Virtual Machines [Image Credit: Aidan Finn]

Marketplace Images

There can be costs associated with some Marketplace images. For example:

  • All Windows virtual machines include the cost of Windows Server (per processor).
  • Any virtual machine image with included paid-for software, such as SQL Server Standard, will have an additional software cost.
  • Some Linux distros have an additional cost.
  • There might be costs for expensive third-party appliances or software that will be automatically charged by Microsoft as soon as they are deployed.
  • Some images are larger/smaller than others and this can impact storage costs.

You can restrict which Marketplace images are used to create new virtual machines. Note that you can also supply custom images. If you choose to enforce restrictions, then you can search for and select images in Virtual Machine Bases > Marketplace Images.

Restricting which Marketplace Images are used to make new virtual machines [Image Credit: Aidan Finn]
Restricting Which Marketplace Images Are Used to Make New Virtual Machines [Image Credit: Aidan Finn]

Tracking Costs

In most “production” virtual machine scenarios, the costs are pretty predictable. Virtual machines either run all of the time or a planned amount of time and they each have a fixed per-minute run-time rate, based on the listed per-hour rate.

A DevTest Lab will be more fluid and very unpredictable. However, your quotas will limit the “damage” that devs and testers can do. You can track cost trends and manage a soft-spend threshold in Cost Tracking > Cost Trend. Various percentages of the soft-spend threshold can be used to create email alerts, be plotted on a chart, or trigger external processes to run via a webhook.

Creating spending alerts in Azure DevTest Labs [Image Credit: Aidan Finn]
Creating Spending Alerts in Azure DevTest Labs [Image Credit: Aidan Finn]

You can also track the costs of each resource created by users in the DevTest Labs in Cost Tracking > Cost By Resource.


A development and test can be a “wild west of IT” because of the bloat of machines, the ever-changing nature, and the constant changing needs of the business. However, with the above controls, you can control and understand the spending, while still giving developers and testers the flexibility to get work done in a timely manner.

Related Topics:


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (0)

Leave a Reply

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by:

Office 365 Coexistence for Mergers & Acquisitions: Don’t Panic! Make it SimpleLive Webinar on Tuesday, November 16, 2021 @ 1 pm ET

In this session, Microsoft MVPs Steve Goodman and Mike Weaver, and tenant migration expert Rich Dean, will cover the four most common steps toward Office 365 coexistence and explain the simplest route to project success.

  • Directory Sync/GAL Sync – How to prepare for access and awareness
  • Calendar Sharing – How to retrieve a user’s shared calendar, or a room’s free time
  • Email Routing – How to guarantee email is routed to the active mailbox before and after migration
  • Domain Sharing – How to accommodate both original and new SMTP domains at every stage

Aimed at IT Admins, Infrastructure Engineers and Project Managers, this session outlines both technical and project management considerations – giving you a great head start when faced with a tenant migration.the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

Sponsored by: