Contributing writer

10 Azure cost management tips

Feb 03, 2022
BudgetingCloud ComputingMicrosoft Azure

Moving to the cloud means paying for computing and services very differently. Understanding how you use Microsoft's public cloud is critical for managing your costs.

cost cloud computing dollar sign hidden costs
Credit: Getty Images

The pandemic has seen enterprises large and small embracing the cloud in droves, driven in part by the strategy’s pay-as-you-go promise, as well as the flexibility, agility, and innovation computing in the cloud can afford.  

But according to a recent Gartner study, 60% of the nearly three quarters of companies that have moved some workloads to the public cloud are likely to face higher costs than they expected. Some of that increased outlay will be due to spending on training or hiring staff with cloud skills, organizational changes aimed at adopting devops, or in not retiring hardware and software replaced by cloud services.

But, especially if demand is unpredictable, any organization making a move to the public cloud may find cloud costs tricky to get a handle on. Following is a look at how enterprises that have adopted Microsoft’s Azure cloud platform can make the most of their cloud spend, leveraging a combination of cost management options available in Azure and hard-earned cloud cost management advice.

Get billing and licencing right

If you can plan for how you’re going to use the cloud, paying in advance is cheaper than pay-as-you-go — and in many cases, you can still pay monthly. Azure reserved instances, for example, are up to 80% cheaper for Windows VMs and Azure SQL Database, with smaller reductions for Linux  VMs, Cosmos DB, Synapse Analytics, Azure App Service, and reserved capacity on Azure Storage.

While you can’t likely predict your Azure needs perfectly in advance, you can plan ahead for your long-term usage on consistent workloads and save money that way. Moreover, reservations purchased in advance for multiple services can be swapped for similar services; so, for example, you can exchange Azure VMware Solution reservations for Azure VMs, but you still can’t use them for Databricks, SAP HANA Large Instance, or RedHat software usage).

It’s also worth comparing the discounts you can get with an Enterprise Agreement, which may depend on negotiations when you renew, or by buying Azure through a Cloud Solution Provider partner. You can use a Microsoft Customer Agreement to streamline the administration of these various purchasing options.

If you have workloads that can cope with being interrupted and don’t need to be completed by a specific time, look at Spot VMs, which run on unused compute capacity and have discounts of up to 90%. Your workload can be evicted if Azure runs out of capacity or the spot price goes over the maximum price you set in advance, but using them with Azure Virtual Machine Scale Sets gives you scalability at a lower price.

If have a Visual Studio subscription, take advantage of the reduced devtest rates you can get on Azure. If you use Cloudflare, you can set up discounted egress from Azure for data from some services.

Many organizations will have on-premises licences from Microsoft for products they’ll be migrating to the cloud. Make sure you’re utilizing the Azure Hybrid Benefit to reduce the cost of Windows Server, SQL Server (including SQL Managed Instance and Azure SQL Database), RedHat and SUSE Linux in Azure — you pay only the reduced compute rate with no need to repurchase licences and you can use the same licence in the cloud and on your own infrastructure for 180 days.

If you’re on older versions of Windows Server or SQL Server and you’re not ready to upgrade, you can get free extended security updates by running those workloads on Azure, including Azure Stack systems (and the updates are available for an extra year).

Rightsize — ideally before you migrate

Because it takes time to buy and provision new hardware in your own infrastructure, organizations are used to overprovisioning hardware in their data centers to cope with peak load. Even with virtualization, 30% utilization isn’t uncommon and you may never have accurately measured what capacity particular workloads really require.

Resist the temptation to pick a more powerful VM in the cloud just in case; by performing workload profiling, you can discover what instances you actually need, thereby saving significantly on your cloud bill while still being able to scale up when more capacity is worth the extra cost. Similarly, only choose a dedicated host service when you’re certain you require the full capacity, because that’s what you’ll be paying for.

But you also don’t want to cut production resources to the bone and scrape along with the bare minimum where application performance matters to the business. The complexity of scaling resources for a mission-critical application where you can’t afford downtime can require some trade-offs.

Do a full inventory before migrating VMs to Azure; you may find some VMs running in your data center that are no longer needed, and you can downsize before you start paying to run them in the cloud.

Equally, if you plan to replace the workload you’re migrating to cloud, it may be a false economy to spend time refactoring it for complete efficiency. The extra cost of running the slightly overpowered instance that a lift-and-shift workload expects for a few months may be worth it if that frees up the people who are building the cloud-native replacement.

Design more efficiently

Making the wrong design choices can be expensive and is harder to spot on your bill than a VM that’s been left on all month.

If you’re migrating to or building on Azure and you have a substantial workload, see if it’s eligible for FastTrack support where Azure engineers will help you define and deploy your systems as efficiently as possible. The Microsoft Cloud Adoption Framework includes best practices and the Azure Well-Architected Framework has a pillar covering cost optimization.

Compare regions

Most Azure services are available in multiple regions and pricing can vary by region. Unless you need the lowest possible latency, you may be able to save money by running a service in a different region rather than the one that’s geographically closest to you.

Turn it off again

The convenience of cloud means you can turn a server on when you need it, and the ability of the cloud to scale up means you can cope with sudden demand and then scale back down again. Look at how you automate scaling up and scaling down. You can use auto-shutdown to create a schedule to turn off VMs that aren’t needed at all out of business hours.  

It’s a false economy to ask developers to use VMs that don’t have the resources they need; your developers are considerably more expensive than cloud resources. But that also means it’s worth managing devtest resources. Azure DevTest Labs, which has auto-shutdown built in, is a good way to make sure non-production, devtest systems aren’t running when they don’t need to be — especially if you move to CI/CD build systems such as Azure DevOps that moves more of the build process to a PaaS.

You can auto-start VMs in DevTest Labs; if you want to do that for standard VMs that you need for a few days a month, use Azure Resource Manager Templates and Azure Automation to start and shutdown on a schedule.

If you’re using Azure Kubernetes Service for devtest or data science workloads, or even production systems that don’t need to run 24/7, you can pause clusters instead of draining the workload to scale the cluster down. That may mean rethinking assumptions such as when you query or back up systems. There’s no point keeping a cloud service running for maintenance that happens at 2am so it doesn’t interrupt employees when you can perform that back up or run that query in the cloud without having an impact on production systems.

Ask Azure what to turn off

Azure Advisor will identify idle or underutilized resources and suggest what to autoscale, shut down, move to a cheaper instance or reserved capacity, and what to deprovision.

Consider PaaS, serverless, or storage

You don’t always need a VM: Use Azure Storage when you need to store files or data (using storage tiers for anything accessed less frequently) and use Azure Batch or Azure Functions to process it on demand. There may be an Azure PaaS services such as Azure Machine Learning, Cognitive Services, or Azure Applied AI Services that already have the features you need where you pay by usage rather than building and paying to develop, test, and run your own end-to-end system.

Take advantage of preview services

Experiment with new features and services to see whether they’re useful, while they’re still in preview and don’t incur any charges.

Check what you’re spending

The best way to overspend is to not know what you’re spending. You can see what resources you’re using and how much they’re costing in the Azure billing portal but Azure Cost Management enables you to budget, allocate costs for centrally managed services, set forecasts, send alerts when usage doesn’t match those forecasts, and use Azure Budgets to automate what happens when those alerts are triggered.

There are also third-party tools such as Inscape Anomaly (which is funded by Microsoft) or Data#3’s Azure Optimizer, which generates reports and suggested schedules to reduce resource usage.

Perform cloud chargebacks and understand cloud benefits

Make sure you have the right policies set up to control who can create subscriptions, buy Azure services, create resources, and allocate reserved instances. Individual services such as Cosmos DB also have cost control options such as throughput spending limits that you can set.

If your Azure bill keeps going up because cloud services are so useful that they’re more popular than you expected, that can be a good thing if those projects are adding business value. You may need to switch to more flexible budgeting, and using chargebacks makes sure the costs end up on the right budget, so the decisions are made by the people who know whether the projects are really adding enough business value to make the increased spend worthwhile.