|
1 | 1 | ---
|
2 | 2 | title: View the monthly estimated lab cost trend
|
3 |
| -description: This article provides information on how to track the cost of your lab (monthly estimated cost trend chart) in Azure DevTest Labs. |
| 3 | +description: This article provides information on how to track the cost of your lab through Azure Cost Management |
4 | 4 | ms.topic: how-to
|
5 | 5 | ms.author: rosemalcolm
|
6 | 6 | author: RoseHJM
|
7 |
| -ms.date: 06/26/2020 |
| 7 | +ms.date: 02/16/2024 |
8 | 8 | ms.custom: UpdateFrequency2
|
9 | 9 | ---
|
10 | 10 |
|
11 | 11 | # Track costs associated with a lab in Azure DevTest Labs
|
12 |
| -This article provides information on how to track the cost of your lab. It shows you how to view the estimated cost trend for the current calendar month for the lab. The article also shows you how to view month-to-date cost per resource in the lab. |
| 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) by applying tags to the DevTest Lab to filter costs. DevTest Labs may create additional 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 | 13 |
|
14 |
| -## View the monthly estimated lab cost trend |
15 |
| -In this section, you learn how to use the **Monthly Estimated Cost Trend** chart to view the current calendar month's estimated cost-to-date and the projected end-of-month cost for the current calendar month. You also learn how to manage lab costs by setting spending targets and thresholds that, when reached, trigger DevTest Labs to report the results to you. |
| 14 | +## Steps to Leverage Cost Management for DevTest Labs |
16 | 15 |
|
17 |
| -To view the Monthly Estimated Cost Trend chart, follow these steps: |
| 16 | +These are the steps needed to leverage cost management for DevTest Labs, more details are captured below. |
| 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 |
18 | 21 |
|
19 |
| -1. Sign in to the [Azure portal](https://portal.azure.com). |
20 |
| -2. Select **All Services**, and then select **DevTest Labs** from the list. |
21 |
| -3. From the list of labs, select your lab. |
22 |
| -4. Select **Configuration and policies** on the left menu. |
23 |
| -4. Select **Cost trend** in the **Cost tracking** section on the left menu. The following screenshot shows an example of a cost chart. |
24 |
| - |
25 |
| -  |
| 22 | +## Step 1: Enable Tag Inheritance for Tags on Resource Groups |
26 | 23 |
|
27 |
| - The **Estimated cost** value is the current calendar month's estimated cost-to-date. The **Projected cost** is the estimated cost for the entire current calendar month, calculated using the lab cost for the previous five days. |
| 24 | +When DevTest Labs creates [environments](devtest-lab-create-environment-from-arm.md), these are each placed in their own resource group. To ensure that the DevTest Lab tags flow down (for billing purposes) from the resource group to the resources, it’s required to enable tag inheritance. |
28 | 25 |
|
29 |
| - The cost amounts are rounded up to the next whole number. For example: |
| 26 | +This can be done either with billing properties OR via Azure Policies. The first method (billing properties) is the easiest & fastest if it doesn’t affect billing reporting for other resources in the same subscription. |
30 | 27 |
|
31 |
| - * 5.01 rounds up to 6 |
32 |
| - * 5.50 rounds up to 6 |
33 |
| - * 5.99 rounds up to 6 |
| 28 | +- [Group and allocate costs using tag inheritance](../cost-management-billing/costs/enable-tag-inheritance) |
| 29 | +- [Use the “Inherit a tag from the resource group” Azure Policy](../azure-resource-manager/management/tag-policies) |
34 | 30 |
|
35 |
| - As it states above the chart, the costs you see by default in the chart are *estimated* costs using [Pay-As-You-Go](https://azure.microsoft.com/offers/ms-azr-0003p/) offer rates. You can also set your own spending targets that are displayed in the charts by [managing the cost targets for your lab.](#managing-cost-targets-for-your-lab) |
| 31 | +If updated correctly using the first method above, you will see that Tag Inheritance now shows **Enabled**: |
36 | 32 |
|
37 |
| - The following costs *aren't* included in the cost calculation: |
| 33 | +  |
38 | 34 |
|
39 |
| - * CSP and Dreamspark subscriptions currently aren't supported. Azure DevTest Labs uses the Azure billing APIs to calculate the lab cost, which doesn't support CSP or Dreamspark subscriptions. |
40 |
| - * Your offer rates. Currently, you can't use the offer rates shown under your subscription that you've negotiated with Microsoft or Microsoft partners. Only Pay-As-You-Go rates are used. |
41 |
| - * Your taxes |
42 |
| - * Your discounts |
43 |
| - * Your billing currency. Currently, the lab cost is displayed only in USD currency. |
| 35 | +## Step 2: Apply Tags to DevTest Labs |
44 | 36 |
|
45 |
| -### Managing cost targets for your lab |
46 |
| -DevTest Labs helps you manage your lab costs by setting a spending target that you can view in the Monthly Estimated Cost Trend chart. DevTest Labs can send you a notification when spending reaches the specified target threshold. |
| 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). |
47 | 38 |
|
48 |
| -1. On the **Cost trend** page, select **Manage target**. |
| 39 | +  |
49 | 40 |
|
50 |
| -  |
51 |
| -2. On the **Manage target** page, specify a spending target and thresholds. You can also set whether each selected threshold is reported on the cost trend chart or through a webhook notification. |
| 41 | +It’s important to remember that tags are propagated for any resources created _after_ the tag has been applied to the DevTest Lab. If there are _existing resources_ that must be updated with the new tags, there is a script available to propagate the new/updated tags correctly. If you have existing resources and want to apply the lab tags, please use the [Update-DevTestLabsTags script located in the DevTest Labs GitHub Repo](https://github.com/Azure/azure-devtestlab/tree/phauge/update-dtl-tags/samples/DevTestLabs/Scripts/UpdateDtlTags). |
52 | 42 |
|
53 |
| -  |
| 43 | +## Step 3: Provide permissions to allow users to view costs |
54 | 44 |
|
55 |
| - - Select a time period during which you want cost targets tracked. |
56 |
| - - **Monthly**: cost targets are tracked per month. |
57 |
| - - **Fixed**: cost targets are tracked for the date range you specify in the start and end dates. Typically, these values represent how long your project is scheduled to run. |
58 |
| - - Specify a **Target cost**. For example, how much you plan to spend on this lab in the time period you defined. |
59 |
| - - Select to enable or disable any threshold you want reported – in increments of 25% – up to 125% of your specified **Target cost**. |
60 |
| - - **Notify**: When results meet this threshold, a webhook URL that you specify notifies you. |
61 |
| - - **Plot on chart**: When results meet this threshold, the results plot on a cost trend graph that you can view. |
62 |
| - - If you choose to **Notify** when the threshold is met, you must specify a webhook URL. In the Cost integrations area, select **Click here to add an integration**. Enter a **Webhook URL** in the Configure notification pane and then select **OK**. |
| 45 | +DevTest Labs users don’t automatically have permission to view costs for their resources via Cost Management. There is an additional step to [enable users to view billing information](../cost-management-billing/costs/assign-access-acm-data#assign-billing-account-scope-access), which is to 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) |
63 | 46 |
|
64 |
| -  |
| 47 | +## Step 4: Use Azure Cost Management for viewing/filtering costs for DevTest Labs |
65 | 48 |
|
66 |
| - - If you specify **Notify**, you must define a webhook URL. |
67 |
| - - Likewise, if you define a webhook URL, you must set **Notification** to **On** in the Cost threshold pane. |
68 |
| - - Create the webhook before you enter it here. |
| 49 | +Now that DevTest Labs has been configured to provide the lab-specific information for Cost Management, please 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). You can visualize the costs in the Azure Portal, download cost reporting information, or use PowerBI to visualize the costs. |
69 | 50 |
|
70 |
| - For more information about webhooks, see [Create a webhook or API Azure Function](../azure-functions/functions-bindings-http-webhook.md). |
| 51 | +For a quick view of costs per lab, please follow the following steps: |
71 | 52 |
|
72 |
| -## View cost by resource |
73 |
| -The monthly cost trend feature in labs allows you to see how much you spent in the current calendar month. The feature also shows your spending projection until the end of the month, based on your spending in last seven days. To help you understand why the spending in the lab is meeting thresholds early on, you can use the **cost by resource** feature that shows you the month-to-date cost **per resource** in a table. |
| 53 | +1. Select **Cost Management** and then on **Cost analysis** |
| 54 | +1. Select **Daily Costs** |
| 55 | +  |
| 56 | +1. On the **Custom: Cost Analysis** page, select the **Group By** filter, choose **Tag** and then the Tag Name (like “CostCenter”) to group by |
| 57 | +  |
74 | 58 |
|
75 |
| -1. Sign in to the [Azure portal](https://portal.azure.com). |
76 |
| -2. Select **All Services**, and then select **DevTest Labs** from the list. |
77 |
| -3. From the list of labs, select the lab you want. |
78 |
| -4. Select **Configuration and policies** on the left menu. |
79 |
| -5. Select **Cost by resource** in the **Cost tracking** section on the left menu. You see the costs associated with each resource associated with a lab. |
| 59 | +The resulting view will show costs in the subscription grouped by the ‘tag’ (which is grouping by the lab & it’s resources). |
80 | 60 |
|
81 |
| -  |
| 61 | +## Related content |
82 | 62 |
|
83 |
| -This feature helps you to easily identify the resources that cost the most so you can take actions to reduce the lab spending. For example, the cost of a VM is based on the size of the VM. The larger the size of the VM, the more it costs. You could find the size of a VM and the owner, and talk to the owner about why they need the VM size and whether they can lower the size. |
84 |
| - |
85 |
| -[Auto shutdown policy](devtest-lab-set-lab-policy.md?#set-auto-shutdown-policy) helps you to reduce the cost by shutting down lab VMs at a particular time of the day. However, a lab user can opt out of the shutdown policy, which increases the cost of running the VM. Select a VM in the table to see if it's been opted-out of the auto shutdown policy. Talk to the VM owner to find out why they opted out, and see if they can opt back in. |
86 |
| - |
87 |
| -## Next steps |
88 |
| -Here are some things to try next: |
89 |
| - |
90 |
| -* [Define lab policies](devtest-lab-set-lab-policy.md). Learn how to set the various policies used to govern how your lab and its VMs are used. |
91 |
| -* [Create custom image](devtest-lab-create-template.md). When you create a 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 VHD file. |
92 |
| -* [Configure Marketplace images](devtest-lab-configure-marketplace-images.md). DevTest Labs supports creating VMs based on Azure Marketplace images. This article |
93 |
| - illustrates how to specify Azure Marketplace images you can use when creating VMs in a lab. |
94 |
| -* [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. |
| 63 | +- [Define lab policies](devtest-lab-set-lab-policy.md). Learn how to set the various policies used to govern how your lab and its VMs are used. |
| 64 | +- [Create custom image](devtest-lab-create-template.md). When you create a 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 VHD file. |
| 65 | +- [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. |
| 66 | +- [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. |
0 commit comments