How to optimize and save money in Microsoft Azure

Photo by David Villasana

It’s critical for businesses to keep costs under control or even at a minimum. Sometimes, the cost of a cloud architecture can represent a significant proportion of total operating expenses. Thus, minimizing the cost of cloud resources is one of the key success factors for anyone whose business depends on services deployed in the cloud.

In this article, we’ll look at a strategy that will help you optimize your use of Microsoft Azure cloud resources and keep costs to a minimum.

Why do you spend money in Azure?

The main feature of cloud architecture pricing is that the total cost of ownership (TCO) is significantly lower than on-premises data centers. This is due to the lack of capital expenditures on the data center, hardware, and maintenance staff. Fully managed and PaaS services further reduce labor costs.

However, operating costs for cloud infrastructure are not fixed. These costs include the cloud resources needed for your solution, as well as resources that are not needed but consume money.

There are 4 ways unwanted redundancy can occur:

Let's look at a common algorithm for identifying and eliminating these causes.

Microsoft Azure Cost Optimization Strategy

Our Microsoft Azure cost-cutting strategy, in a simplified form, consists of the following stages:

Stage 1: Analysis of existing infrastructure

Stage 2: Optimization of cloud resources

Stage 3: Optimization of Azure subscription as a whole

Now, let’s look at how to implement these stages for specific Microsoft Azure services.

Resource organization and monitoring

Before doing anything, you need to know the current status of your cloud solution. This means having a clear picture of what services are used, what they are used for, who created them, and who owns them. In Microsoft Azure, there is a Resource Group for logical grouping of resources and it is also possible to add metadata to each resource using tags. If these grouping elements are missing, you should at least add tags.

Next, you should use the core Microsoft Azure monitoring services that allow you to get insight into Azure Subscription, namely Azure Cost Management and Azure Advisor.

The Azure Cost Management service allows you to identify the most expensive cloud resources or groups of resources, visualize the distribution of cost per resource, and identify trends. The dashboards of this service will allow you to drill down and identify the most likely candidates for optimizing the cost of cloud resources.

The Azure Advisor service can provide the most obvious and quickest way to implement recommendations regarding security, performance, and cost optimization. For example, Azure Advisor may recommend changing the size of the VM if its resources are underutilized or activating the automatic shutdown of VM.

In order to better understand the infrastructure or, more specifically, to identify the trend in the use of virtual machine resources and databases, as well as to check the actual use of PaaS services, you should configure and apply the Azure Monitor.

IaaS Cost Optimization

Now, let’s consider how the recommendations from Stage 2 can be applied to optimize cloud services for IaaS resources - Azure Virtual Machines.

All VM instances have a built-in automatic shutdown feature that allows you to disable virtual machines at specific times.

In order to automate the activation of virtual machines or implement more complex logic to start and stop them (for example, on non-working days or when certain business conditions occur), you can apply the service Azure Automation.

For those cases where computing resources are required irregularly and rarely (e.g., dev, tests, batch jobs, VM Scale sets, etc.), instead of using the usual virtual machines with the pay-as-you-go pricing model, you can use Azure Spot VMs. However, in this case, you must remember that the virtual machine can be deallocated (the process depends on the VM eviction policy) if the maximum VM price on the spot market rises above the current spot price you set.

For those cases where long-term computing resources are required, it is possible to use Reserved VM Instances with a one or three-year reservation.

PaaS Cost Optimization

The peculiarity of PaaS service pricing tiers is that often different levels have a different set of features and limitations. However, the recommendations described in Step 2 can also be used for PaaS. For example, the Azure SQL service has different pricing methods. For the vCore model, the number of cores can be adjusted while, for the traditional Basic / Standard / Premium model, sublevel variations are possible within each level. The same can be applied to the optimization of Cosmos DB.

The correct price level can be selected and set once if the load on the database is almost constant. Or, you can choose to automate switching between price levels using the Azure Automation service. If the database load is unpredictable, you can apply the Serverless pricing model.

Sometimes, it is possible that Azure SQL database instances are used independently and unevenly by many clients. In this case, in order to use allocated resources more efficiently rather than using a set of separate independent databases, it is possible to combine them into an Elastic Database Pool. In doing so, computing and storage resources become allocated to the entire database group and are used more efficiently.

When it comes to data storage in Azure Blob Storage, it is possible to configure Lifecycle management, built into Azure Blob service, to optimize costs. This allows you to configure the movement of files from levels optimized for high availability (Hot) to levels optimized for storing large volumes of files at a lower cost and availability (Cold and Archive).

Ready to optimize?

In this article we’ve covered the general algorithm for optimizing the cost of cloud resources and looked at some specific techniques for saving on Microsoft Azure services.

Generally, the optimization of cloud architectures, especially hybrid architectures, is a complex but necessary process. The result of such optimization will directly impact your business by reducing infrastructure operating costs.

Talk to our experts and they will help you create and implement a cloud resource cost optimization plan that works for your business. We'll walk you through all the steps and, most importantly, save you money!

Don’t hesitate— contact us today at sales@fastdev.se.