Cost management for Azure Lab Services

For Azure Lab Services, cost management can be broken down into two distinct areas: cost estimation and cost analysis. Cost estimation occurs when you're setting up the lab to make sure that the initial structure of the lab will fit within the expected budget. Cost analysis usually occurs at the end of the month to determine the necessary actions for the next month.

Estimate the lab costs

Each lab dashboard has a Costs & Billing section that lays out a rough estimate of what the lab will cost for the lab. The estimate uses the number schedules, quota hours, extra quota for individual students, and lab capacity when calculating the cost estimate. Changes to the number of quota hours, schedules or lab capacity will affect the cost estimate value.

This estimate might not show all the possible costs. A few resources aren't included:

  • The template VM preparation cost. It can vary significantly in the amount of time needed to create the template. The cost to run the template is the same as running any lab VM.
  • Any compute gallery costs. Compute galleries can be shared among multiple labs.
  • Cost incurred when the lab creator starts a virtual machine (VM).
  • Networking costs if the lab is using advanced networking.

Screenshot that shows the dashboard cost estimate in Azure Lab Services.

Cost analysis

The cost analysis is for reviewing the previous month's usage to help you determine any adjustments you need to make for a lab. You can find the breakdown of past costs in the subscription cost analysis.

  1. In the Azure portal, select All services. Select Cost management from the quick access list or select Cost management + billing from the General category.

    Screenshot that shows the All services page.  The Cost management icon and Cost manage plus billing icon are highlighted.

  2. Select the Subscription page and select subscription you wish to analyze.

    Screenshot that shows the Subscriptions page in Cost Management + Billing.  The Subscriptions menu is highlighted.

  3. Select Cost analysis in the left pane under the Cost management heading.

    Screenshot that shows a subscription cost analysis on a graph.

The Cost analysis dashboard allows in-depth cost analysis, including the ability to export to different file types on a schedule. For more information, see Cost Management + Billing overview.

You can filter by service or resource type. To see only costs associated with Azure Lab Services, set the service name filter equal to azure lab services. If filtering on resource type, include Microsoft.Labservices/labaccounts resource type. If using the August 2022 Update, also include the Microsoft.LabServices/labs resource type.

Understand the entries

Changing the view on Cost Analysis page to Cost by resource shows the individual charges. By default, there are six columns: Resource, Resource type, Location, Resource group name, Tags, and Cost. The Resource column contains the information about the lab plan, lab name, and VM. If the cost is associated with a template VM, the resource will be in the form {lab account}/{lab name}/default. If the cost is associated with a student lab VM, the resource will be in the form {lab account}/{lab name}/default/{vm name}.

In this example, adding the first and second rows (both start with "aaalab / dockerlab") will give you the total cost for the lab "dockerlab" in the "aaalab" lab account or lab plan.

Screenshot that shows an example cost analysis for a subscription for Azure Lab Services associated costs.

If you're using the August 2022 Update, the entries in are formatted differently. The Resource column will show entries in the form {lab name}/{number} for Azure Lab Services. Some tags are added automatically to each entry when using the August 2022 Update.

Tag name Value
ms-istemplate Set to true if cost associated with a template VM in a lab. Set to false, otherwise.
ms-labname Name of the lab.
ms-labplanid Full resource ID of the lab plan used when creating the lab.

Screenshot that shows an example cost analysis for a subscription using August 2022 Update for Azure Lab Services associated costs.

To get the cost for the entire lab, don't forget to include external resources. Azure Compute Gallery related charges are under the Microsoft.Compute namespace. The advanced networking charges are under the Microsoft.Network namespace.

Note

A compute gallery and virtual network can be connected to multiple labs.

Separate the costs

Since cost entries are tied to the lab account, some schools use the lab account and the resource group as ways to separate the classes. Each class has its own lab plan and resource group.

In the cost analysis pane, add a filter based on the resource group name for the class. Then, only the costs for that class will be visible. Grouping by resource group allows a clearer delineation between the classes when you're viewing the costs. You can use the scheduled export feature of the cost analysis to download the costs of each class in separate files.

In the August 2022 Update:

  • Cost entries are tied to a lab VM, not the lab plan.
  • Cost entries get tagged with the name of the lab the VM is tied to. You can filter by the lab name tag to view total cost across VM in that lab.
  • Cost entries get tagged with the ID of the lab plan when creating the lab. You can filter by the lab plan tag to view total cost across labs created from a lab plan.
  • You can set custom tags on labs or resource groups containing the labs to organize and analyze cost.

Manage costs

Depending on the type of class, there are ways to manage costs to reduce instances of VMs that are running without a student using them.

Automatic shutdown settings for cost control

Automatic shutdown features enable you to prevent wasted VM usage hours in the labs. To configure automatic shutdown for a lab plan, see Configure automatic shutdown of VMs for a lab plan. You can configure these settings at both the lab plan/lab account level and the lab level.

Scheduled time and quota time

Schedules and Quota are two ways of allowing access to the lab VMs.

In the schedule, you can add a stop-only event type that will stop all machines at a specific time. Some lab owners have set a stop-only event for every day at midnight to reduce the cost and quota usage. The downside to this type of event is that all VMs will be shut down, even if a student is using a VM.

Some costs aren't rolled into Lab Services but can be tied to a lab service. You can connect a compute gallery to a lab, but it won't show under the Lab Services costs and does have costs. To help keep overall costs down, you should remove any unused images from the gallery because the images have associated storage costs.

Labs can have connections to other Azure resources through a virtual network is using advanced networking. When a lab is removed, you should remove the virtual network and the other resources.

Conclusion

Hopefully, the information in this article has given you a better understanding of the tools that can help you reduce usage costs.