One of the questions we get asked repeatedly by customers is “How do I keep control of my cloud spending and make sure I don’t end up with an unexpectedly large bill?”
The good news is that cost reporting is built in to the Azure portal and, with a little configuration, provides some basic but effective tools for alert generation, and both scheduled and on-demand reporting.
The very first thing to address is setting a budget. Budgets are set at the subscription level, but can have additional filters to reduce this scope if necessary. Ensure that you have at least one budget per subscription if you want to avoid unexpected costs. Budgets can be set for specific functions using Resource Groups, or multiple subscriptions, to separate workloads.
Reporting of costs is achieved in the Cost Analysis blade. Analysis is divided into Views of type “Built-In”, “Shared”, “Private” and “Preview”.
Preview views are for cost analysis features under development. Shared views are reports that are shared across some or all of your organisation. Built-in views are the starting set of reports provided by Microsoft which can be modified using filters to provide the view(s) most relevant to your organisation. Data can be presented visually as graphs in area, line, column format, or as a table. Note that the graph continues past the current date providing a forecast of future costs based on current resource utilisation. The forecast outcome is obviously not guaranteed but still provides a useful guide.
Once you have a view that you’re happy with you can Save the view as either a public (Shared) view which are visible to other administrators and can then be shared using a URI, or a Private view for yourself.
Once reports have been created they can be scheduled for regular delivery via email to a list of email addresses or distribution groups by clicking the Subscribe button at the top of the report view. Schedules can be set on a daily, weekly or monthly basis with a defined start and end date. A breakdown of the costs can be included as a CSV in the email by checking the appropriate option in the schedule, allowing the recipient to manipulate the data locally in Excel or similar spreadsheet application.
You may have noticed when looking at the report section that (limited) resource metadata is available as filtering options. This opens up the possibility of creating report filters which focus on specific Resource Groups, Resource types, or Resource Tags.
Having a tagging policy in your organisation specifically provides a mechanism for reporting, and potentially recharging, costs. Resource Groups can also be used to achieve this but are much less flexible and may not be practical in larger deployments. Reports grouped in this way can be saved, and scheduled, in the same way as described above.
The best way to ensure that Tags are assigned reliably and consistently is by using Azure Policy.
Having the cost analysis data is all good, but it’s only useful if someone looks at it. This is where you may want an alert to notify you should a particular threshold be met. There are two locations alerts can be set – at the subscription level for alerts related to Anomalies and Reservation use, and at the Budget level for actual and forecast values.
Alerts can by of type Actual or Forecast. Actual alerts are based on spend already incurred, so are useful when placed close to a budgetary threshold that you do not expect to exceed. Forecast alerts provide an early-warning before costs are incurred. These are useful when set above a budget threshold and allow action to be taken to reduce spending and bring costs back within budget. This can be very useful if the costs of a new resource is misconfigured incurring much higher than expected as it allows an administrator to shutdown, remove the resource or correct the misconfiguration before significant overspend occurs.
Alerts can trigger a simple email, similar to a scheduled report, or it can trigger an action group which provides a rich set of features to interact with the Azure environment and take automated actions once triggered. Action groups are very powerful features and almost unlimited in scope as they can be used as a trigger to external services such as raising a ticket in an ITSM system, triggering an Azure Rubbook, Function or Logic App, or using a Webhook to interface with any number of other services.
Unexpected costs are a significant concern for most customers when extending their IT service into the cloud. Azure Cost Management provides a simple yet effective set of tools to monitor, report, and alert on current costs and those that are expected to be incurred in future. The key here is to continue to refine the cost management configuration over the lifetime of the cloud infrastructure, but ensure that basic budget and alert values are set early, ideally during the creation of each new subscription.