|
1 | 1 | ---
|
2 | 2 | title: Track costs associated with a lab in Azure DevTest Labs
|
3 |
| -description: This article provides information on how to track the cost of your lab through Azure Cost Management. |
| 3 | +description: Track the cost of your lab through Microsoft Cost Management with custom tags, tag inheritance, and filtered views. |
4 | 4 | ms.topic: how-to
|
5 | 5 | ms.author: rosemalcolm
|
6 | 6 | author: RoseHJM
|
7 |
| -ms.date: 03/28/2024 |
| 7 | +ms.date: 06/03/2024 |
8 | 8 | ms.custom: UpdateFrequency2
|
| 9 | + |
| 10 | +#customer intent: As a developer, I want to use Microsoft Cost Management to track and manage the costs associated with my DevTest Labs resources. |
9 | 11 | ---
|
10 | 12 |
|
11 | 13 | # Track costs associated with a lab in Azure DevTest Labs
|
12 |
| -This article provides information on how to track the cost of your lab through [Azure Cost Management](../cost-management-billing/cost-management-billing-overview.md) by applying tags to the lab to filter costs. DevTest Labs may create more resource groups for resources related to the lab (depending on the features used and the settings of the lab). For this reason, it’s often not straightforward to get a view of the total costs for a lab just by looking at Resource Groups. To create a single view of costs per lab, tags are used. |
13 | 14 |
|
14 |
| -## Steps to Leverage Cost Management for DevTest Labs |
| 15 | +This article provides information on how to track the cost of your lab through [Microsoft Cost Management](../cost-management-billing/cost-management-billing-overview.md) by applying tags to the lab to filter costs. |
| 16 | + |
| 17 | +DevTest Labs can create extra resource groups for resources related to your lab. The number of resource groups created depends on the features used by the lab and their settings. Because of the extra resource groups, it's often not straightforward to get a view of the total costs for your lab just by looking at **Resource groups** in the Azure portal. To create a single view of costs per lab in the Azure portal, you can use resource group **Tags**. |
| 18 | + |
| 19 | +## Apply Cost Management for DevTest Labs |
| 20 | + |
| 21 | +The process for using cost management for DevTest Labs involves four steps: |
| 22 | + |
| 23 | +1. Create tags and enable tag inheritance in the Azure portal. |
| 24 | +1. Apply the tags to your DevTest Labs resources. |
| 25 | +1. Provide permissions to allow users to view their resource costs. |
| 26 | +1. Use Microsoft Cost Management to view and filter costs for your DevTest Labs resources, based on your tags. |
| 27 | + |
| 28 | +You might create tags to allow users to track billed charges by cost center, business unit, team project, and so on. |
15 | 29 |
|
16 |
| -These are the steps needed to use cost management for DevTest Labs. More details are captured in the following sections. |
17 |
| -1. Enable tag inheritance for costs. |
18 |
| -1. Apply tags to the DevTest Labs (cost center, business unit, etc.). |
19 |
| -1. Provide permissions to allow users to view costs. |
20 |
| -1. Use Azure Cost Management for viewing/filtering costs for DevTest Labs, based on the tags. |
| 30 | +The details for these steps are described in the following sections. |
21 | 31 |
|
22 |
| -## Step 1: Enable Tag Inheritance for Tags on Resource Groups |
| 32 | +## Create tags and enable tag inheritance |
23 | 33 |
|
24 |
| -When DevTest Labs creates [environments](devtest-lab-create-environment-from-arm.md), they are each placed in their own resource group. For billing purposes, you must enable tag inheritance to ensure that the lab tags flow down from the resource group to the resources. |
| 34 | +When DevTest Labs creates [environments](devtest-lab-create-environment-from-arm.md), it places each environment in its own resource group. For billing purposes, you must enable tag inheritance to ensure the lab tag definitions flow down from the resource group to the resources. |
25 | 35 |
|
26 | 36 | You can enable tag inheritance through billing properties or through Azure Policies. The billing properties method is the easiest and fastest to configure. However, it might affect billing reporting for other resources in the same subscription.
|
27 | 37 |
|
28 |
| -- [Group and allocate costs using tag inheritance](../cost-management-billing/costs/enable-tag-inheritance.md) |
| 38 | +The following articles describe how to create tags and enable tag inheritance: |
| 39 | + |
| 40 | +- [Group and allocate costs by using tag inheritance](../cost-management-billing/costs/enable-tag-inheritance.md) |
29 | 41 | - [Use the "Inherit a tag from the resource group" Azure Policy](../azure-resource-manager/management/tag-policies.md)
|
30 | 42 |
|
31 |
| -If updated correctly using the billing properties method, you see that Tag Inheritance now shows **Enabled**: |
| 43 | +If the lab is updated correctly by using the billing properties method, you see **Tag inheritance** is **Enabled**: |
32 | 44 |
|
33 |
| -:::image type="content" source="./media/devtest-lab-configure-cost-management/tag-inheritance.png" alt-text="Screenshot that shows Tag Inheritance is enabled."::: |
| 45 | +:::image type="content" source="./media/devtest-lab-configure-cost-management/devtest-tag-inheritance.png" alt-text="Screenshot that shows Tag Inheritance is Enabled for cost management in the Azure portal." lightbox="./media/devtest-lab-configure-cost-management/devtest-tag-inheritance-large.png"::: |
34 | 46 |
|
35 |
| -## Step 2: Apply Tags to DevTest Labs |
| 47 | +## Apply tags to DevTest Labs |
36 | 48 |
|
37 |
| -DevTest Labs automatically propagates tags applied at the lab level to the resources that are created by the lab. This includes virtual machines (tags are applied to the billable resources) and environments (tags are applied to the resource group for the environment). Follow the steps in this article to apply tags to your labs: [Add tags to a lab](devtest-lab-add-tag.md). |
| 49 | +DevTest Labs automatically propagates tags applied at the lab level to resources created by the lab. For virtual machines, tags are applied to the billable resources. For environments, tags are applied to the resource group for the environment. To apply tags to your labs, follow the steps in [Add tags to a lab](devtest-lab-add-tag.md). |
38 | 50 |
|
39 |
| -:::image type="content" source="./media/devtest-lab-configure-cost-management/devtest-tags.png" alt-text="Screenshot that shows tags in DevTest Labs in the Azure portal."::: |
| 51 | +:::image type="content" source="./media/devtest-lab-configure-cost-management/devtest-tags.png" alt-text="Screenshot that shows tags added for a DevTest Labs resource in the Azure portal." lightbox="./media/devtest-lab-configure-cost-management/devtest-tags-large.png"::: |
40 | 52 |
|
41 | 53 | > [!NOTE]
|
42 |
| -> It’s important to remember that tags are propagated for any resources created _after_ the tag has been applied to the lab. If there are _existing resources_ that must be updated with the new tags, there's a script available to propagate the new/updated tags correctly. If you have existing resources and want to apply the lab tags, use the [Update-DevTestLabsTags script located in the DevTest Labs GitHub Repo](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/UpdateDtlTags). |
| 54 | +> After you apply a new tag to your lab, the tag is automatically applied to new lab resources when they're created. If you want to apply a new or updated tag to existing resources, you can use a script to propagate the tag correctly. Use the [Update-DevTestLabsTags script](https://github.com/Azure/azure-devtestlab/tree/master/samples/DevTestLabs/Scripts/UpdateDtlTags) located in the DevTest Labs GitHub repository. |
| 55 | +
|
| 56 | +## Provide permissions to view costs |
| 57 | + |
| 58 | +DevTest Labs users don't automatically have permission to view costs for their resources by using Cost Management. To add the permissions, follow the instructions in [enable users to view billing information](../cost-management-billing/costs/assign-access-acm-data.md#assign-billing-account-scope-access). Assign the _Billing Reader_ permission to users at the subscription level, if they don't already have permissions that include Billing Reader access. |
| 59 | + |
| 60 | +For more information, see [Manage access to Azure billing - Microsoft Cost Management](../cost-management-billing/manage/manage-billing-access.md). |
| 61 | + |
| 62 | +## View and filter costs |
43 | 63 |
|
44 |
| -## Step 3: Provide permissions to allow users to view costs |
| 64 | +After DevTest Labs is configured to provide the lab-specific information for Microsoft Cost Management, you're ready to get started with [Cost Management reporting - Azure - Microsoft Cost Management](../cost-management-billing/costs/reporting-get-started.md). You can visualize the costs in the Azure portal, download cost reporting information, or use Power BI to visualize the costs. |
45 | 65 |
|
46 |
| -DevTest Labs users don’t automatically have permission to view costs for their resources via Cost Management. There's one more step to [enable users to view billing information](../cost-management-billing/costs/assign-access-acm-data.md#assign-billing-account-scope-access). Assign the _Billing Reader_ permission to users at the subscription level, if they don’t already have permissions that include Billing Reader access. More information is found here on managing access to billing information: [Manage access to Azure billing - Microsoft Cost Management.](../cost-management-billing/manage/manage-billing-access.md) |
| 66 | +For a quick view of costs per lab, following these steps: |
47 | 67 |
|
48 |
| -## Step 4: Use Azure Cost Management for viewing and filtering costs for DevTest Labs |
| 68 | +1. In the [Azure portal](https://portal.azure.com), go to your lab, and select a resource group that has tags. |
49 | 69 |
|
50 |
| -Now that DevTest Labs is configured to provide the lab-specific information for Cost Management, start here on Cost Management Reporting to view costs: Get started with [Cost Management reporting - Azure - Microsoft Cost Management](../cost-management-billing/costs/reporting-get-started.md). You can visualize the costs in the Azure portal, download cost reporting information, or use Power BI to visualize the costs. |
| 70 | +1. On the left menu, expand **Cost Management**, and select **Cost analysis**. |
51 | 71 |
|
52 |
| -For a quick view of costs per lab, see the following steps: |
| 72 | +1. In the **Cost analysis** page, expand the **View** dropdown list, and select **Daily Costs**: |
53 | 73 |
|
54 |
| -1. Select **Cost Management** and then on **Cost analysis** |
55 |
| -2. Select **Daily Costs** |
| 74 | + :::image type="content" source="./media/devtest-lab-configure-cost-management/daily-costs.png" alt-text="Screenshot that shows how to view daily costs for resources in the Azure portal." lightbox="./media/devtest-lab-configure-cost-management/daily-costs-large.png"::: |
56 | 75 |
|
57 |
| -:::image type="content" source="./media/devtest-lab-configure-cost-management/daily-costs.png" alt-text="Screenshot that shows the daily costs card."::: |
| 76 | +1. On the **Cost Analysis** page, expand the **Group By** filter, select **Tag**, and then select one of your applied tags: |
58 | 77 |
|
59 |
| -3. On the **Custom: Cost Analysis** page, select the **Group By** filter, choose **Tag** and then the Tag Name (like "CostCenter") to group by. Refer to the [documentation on group and filter options in Cost Management](../cost-management-billing/costs/group-filter.md) for more details. |
| 78 | + :::image type="content" source="./media/devtest-lab-configure-cost-management/group-by-tag.png" border="false" alt-text="Screenshot that shows how to change the Group by filter to show cost details based on applied tags."::: |
60 | 79 |
|
61 |
| -The resulting view shows costs in the subscription grouped by the tag (which is grouping by the lab & its resources). |
| 80 | + The updated view shows costs in the subscription grouped by the tag according to the lab its resources. For more information, see the [documentation on group and filter options in Cost Management](../cost-management-billing/costs/group-filter.md). |
62 | 81 |
|
63 | 82 | ## Related content
|
64 | 83 |
|
65 |
| -- [Define lab policies](devtest-lab-set-lab-policy.md). Learn how to set the various policies used to govern how your lab and its virtual machines (VMs) are used. |
66 |
| -- [Create custom image](devtest-lab-create-template.md). When you create a virtual machine (VM), you specify a base. The base can be either a custom image or a Marketplace image. This article describes how to create a custom image from a virtual hard disk (VHD) file. |
67 |
| -- [Configure Marketplace images](devtest-lab-configure-marketplace-images.md). DevTest Labs supports creating VMs based on Azure Marketplace images. This article illustrates how to specify Azure Marketplace images you can use when creating VMs in a lab. |
68 |
| -- [Create a VM in a lab](devtest-lab-add-vm.md). This article illustrates how to create a VM from a custom or Marketplace base image, and work with artifacts in the VM. |
| 84 | +- [Use tags to organize your Azure resources and management hierarchy](/azure/azure-resource-manager/management/tag-resources) |
| 85 | +- Review the [resource naming and tagging decision guide - Cost management and optimization](/azure/cloud-adoption-framework/ready/azure-best-practices/resource-naming-and-tagging-decision-guide) |
| 86 | +- [Define DevTest Labs policies](devtest-lab-set-lab-policy.md) |
0 commit comments