Many organizations need to track costs of their Azure resources and ensure they don’t exceed a certain budget. However, as the number of systems and individual resources grows, it may be really difficult to achieve.

CloudMonix monitors Azure Billing to track utilization and costs per individual resource, systems, departments or customers.  Additionally, since costs can be used in alerts and automation rules, CloudMonix users can get notifications when costs rapidly increase as compared to the previous month or previous day.  

Furthermore, users can set up automation rules to shut down or pause expensive resources when they exceed a certain price threshold.

In this article we’ll show how to automatically pause a SQL Server Warehouse when its costs exceed 1000$ in the current month:

1. Run CloudMonix Setup Wizard to connect to your Azure environment

If you aren’t using CloudMonix yet, sign up for a free account, then authorize CloudMonix to view your Azure subscription. Learn more about the setup process here.

2. Specify Offer and Currency

CloudMonix obtains information about resources utilization from Azure Management API and calculates costs based on the selected offer and currency.

It’s really important to specify the right offer and currency when configuring Azure Billing resource to guarantee that CloudMonix cost calculations are correct.

3. Start tracking SQL Data Warehouse costs

By default, CloudMonix tracks cost broken down by resources for the current month in a metric called “CurrentMonthBreakdownByResource”. The results are presented as a table containing resource group names and current metric values.

In this example, we want to track costs of an individual resource, i.e. a specific SQL Data Warehouse. To track its costs:

  • Open “Azure Billing” configuration dialog.
  • In the “Metrics” tab define a new metric of type “AzureBillingResourcePrice”  (screenshot below).
  • Specify the desired billing period, e.g. for the current month select “Since Start Billing Period”.
  • Using “Resource group” and “Resource” drop-downs, find the SQL Data Warehouse that should be monitored.

4. Pause SQL Data Warehouse when costs exceed the threshold

SQL Data Warehouse should be paused when its cost exceeds 1000$ in the current month. It’s a good idea to also verify if the resource is active and running before requesting the pause to avoid unnecessary requests.

To pause SQL Data Warehouse when costs exceed the threshold:

  • Open “Azure Billing” configuration dialog.
  • In the “Metrics” tab define a new metric of type “LinkedMetric” that tracks SQL data warehouse costs. In the “Metric from another resource” find a metric defined in the previous step (screenshot below).
  • In the “Actions” tab define a new action that will execute the “AzureSqlWarehousePause” action on the SQL Data Warehouse. The action should be triggered when the previously defined cost exceeds 1000$ assuming the resource is active (screenshot below).

CloudMonix can also be used to track and control costs per system or customer. Read this article to learn more.