Once again this year, as part of the Festive Tech Calendar 2021, I’m joining about 138 (!!!) very talented people in submitting a festive topic. In this blogpost I will how you can save a buck when using the Azure cloud platform so you can spend more on holiday gifts! Be sure to check out the many other sessions, livestreams and blogs over at the Festive Tech Calendar!

Festive Tech Calendar! Festive Tech Calendar!

Something important before we start…

This year the community lost the very talented Abel Wang. In his memory, friends inside and outside of Microsoft are raising money for the nonprofit GirlsWhoCode organization which aims to support and increase the number of women in computer science by equipping young women with the necessary computing skills to pursue 21st century opportunities. The organization works toward closing the gender employment difference in technology, and to change the image of what a programmer looks like. Please visit and donate if you can. The awesome @TheAprilEdwards is making sure Microsoft is matching donations. Thank you for considering!

Saving money on Azure

On to the topic at hand, saving money on Azure so we can buy our friends and families more holiday gifts. We’ll approach this in a number of ways:

  • Cost Analysis (Where are we spending)
  • Cost Control (Making sure we don’t overspend)
  • Cost Optimization (Reducing cost)

Officially Cost Management is part of the five disciples of Cloud Governance which is part of the Cloud Adoption Framework. Check out the docs for Microsoft’s guidance withing the CAF.

Cost Analysis

First, we’ll need to know what’s eating up money within our Azure infrastructure. As you know, most services in Azure work on a per-hour billing cycle, allowing for great innovation at lower cost (only ramp up services when you actually need them). Failing to manage these resources though will allow the bill to get quite high. Using the Azure Cost Management pane, you’ll be able to see what resources are eating up what cost. You can also quickly glance at the projected upcoming cost where Azure estimates the resulting costs for this billing period.

Azure Cost Management Azure Cost Management

@SoniaCuff has a great video on this topic:

Notice that by default you can only see cost of specific resource types, groups and subscriptions. To get more control of these views, we need to implement tagging. By tagging the individual resources, we can filter down based on our own custom grouping. Tagging can be useful to identify owners, define cost centers and bill resource internally in your organization. Note that cost management doesn’t work retroactively when it comes to tagging. Only costs occurred after tagging the resources can be filtered using this option. Also putting tags on the resource group isn’t enough, it needs it on per-resource basis. You can however use Azure Policy to enforce a tag/value needs to be set or have it inherit the tags from the resource group.

Cost Control

Using the steps above, we’ve gotten some insight on cost. Now let’s switch over to getting a grip on cost incurred. We start with setting up Cost Control Budgets. Using the Cost Management pane, we can define a new Budget for our Developers Kitchen. You can set a specific scope (limiting it to specific subscription or resource group) or by filtering it by specific values (remember those tags you set?). Using this new budget, we can get insights on how we’re performing with regards to the budgets and see what trends we’ll see in the future.

Azure Cost Management - Budget Azure Cost Management - Budget
Azure Cost Management - Budget Trend Azure Cost Management - Budget Trend

When we get close to the top of the budget, we can set notifications and actions that should occur when we’re overspending. You can create email alerts, integrate into your ITSM tool or run specific Automation Runbooks/External Webhooks.

Azure Cost Management - Budget Azure Cost Management - Budget
Azure Cost Management - Budget Azure Cost Management - Budget
Azure Cost Management - Budget Azure Cost Management - Budget

Note that even though we can use automation to scale down Azure services, you can’t set hard quotas like you have in MSDN subscriptions.

Cost Optimization

Now that I’ve shown you what you’re spending money on and how you can get alerts, let’s focus on spending less. We can achieve this in a number of ways:

Move to SaaS

Are you still running Exchange servers in VMs? Or still relying on File Servers to host documents for information workers? Consider what an Software-as-a-Service offering such as Microsoft 365 will cost your organization. Keep in mind that running services in VMs also means you need to secure, patch and administer the service yourself. SaaS solutions are by far the easiest way to save cost and reduce complexity in your IT infrastructure.

Optimize to PaaS

Do you have larger documents that don’t really have a fit on SaaS offerings or run your own database software on a VM? Try to consider the different Platform-as-a-Service offerings in Azure to host them instead. Often, the functionality is nearly the same, you’ll profit from economics of scale and reduced complexity. For instance, you can use Azure Storage Accounts to host files directly over a SMB protocol to clients using Azure Files. Or explore the many SQL/data offerings in Azure like Azure SQL or Cosmos DB. This option does require you to redesign your services but Azure does offer in-place replacement services with full functionality with older services. Less messing around in VMs, more getting stuff done.

Using Azure Advisor

Azure Advisor is a great free service included in every Azure environment. It shows you how you can improve your Azure services, in a number of ways. Reliability, security but also cost management. When you drill down into the advice it shows shows you, it warns you about alienated resources (like unused public IPs) and oversized VMs. It actually looks at the usage pattern of the VM itself and can suggest a new (possibly smaller) VM size. Do keep in mind it’s just an algorithm looking at usage patterns. It can’t predict how you do business or if you over-dimensioned your VM on purpose because you’re expecting spikes in usage or have certain processes running a specific times. Still, do consider whether you actually need all that capacity all the time. Perhaps offload certain processes in the VM to an Azure Function / Azure Batch PaaS service and have minimum VM usage.

Azure Advisor showing different options to save on cost Azure Advisor showing different options to save on cost

Hybrid Use Benefit & Reserved Instances

Hybrid Use Benefit (HUB) and Reserved Instances (RI) are both licensing related measures you can take to reduce cost. HUB is mostly focused on organizations that used a lot of on-premises software licenses and are now looking to move towards Azure. By default, a lot of Azure services have licenses including in the hourly/monthly cost so you have maximum flexibility in how many licenses you need and for how long. Gone are the days you had to plan ahead or reallocate licenses to your infrastructure. However, if you entered an Enterprise Agreement (with Software Assurance), Microsoft allows you to re-use the unused licenses that were part of your on-premises software licensing agreement. Don’t worry, you’ll have an 180 day grace period for re-using the on-prem licenses in the Azure cloud, to help with the migration. Consider something like SQL Server, you can really save a lot of money on resources.

Saving money on licensing Saving money on licensing

Azure is a very flexible platform. Within minutes, you can have entire farms of compute or data resources at your fingertips and delete it all three days later. However, this flexibility has a dark side: Cost. In order to meet all the flexible demand, Microsoft has to overprovision Azure hardware and network by a lot. If you commit to Azure for longer time, by purchasing a Reserved Instance token, Microsoft will give you significant discounts on the Azure services. You can of course combine it with HUB if you have space left in your EA license agreement.

Committing long term to Azure saves cost Committing long term to Azure saves cost
Different services apply for RI Different services apply for RI

Turning resources off

As noted above, Azure is a very flexible platform. When you’re not using reserved instances, you’re paying per hour of resources being active. The big one here is compute, in many different forms and shapes. When you have Virtual Machines, you’re using disk storage, networking, possibly public IPs and the compute cost itself. Unfortunately taking down the storage (deleting the disk and recovering them later on) isn’t very practical. However, shutting down the compute resource itself (and deallocate it) can really reduce cost. Think of compute that’s only needed during business hours.. Consider that 08:00 -> 18:00 is only 10 hours, 5 days per week.. that’s less than 30% of the week. That’s 70% of extra compute you’re paying for if running 24/7. Of course, it depends on it’s function whether the system can actually be shut off. Virtual Machine Scale Sets and Azure Virtual Desktop farms are examples in which you can scale up compute during demanding business hours and wind down to single instance or zero-compute. Combine this with auto-shutdown and new features like “Start Virtual Machine on Connect” for AVD to be more flexible with your cost and compute.

Optimize VMs

We touched on this in the Azure Advisor section.. it’ll suggest new VM sizes that better suit your compute/cost ratio. However there is a vast number of Virtual Machine sizes (great tool for comparing them here: AzurePrice.net). Consider the Av2 series for development purposes and the B series offers great flexibility: It allows you to save up compute credits when your CPU usage is low so you can exchange the credits later on for more CPU power, all at a lower cost because you’re not reserving compute power you mostly don’t need.

Another great option is Azure Spot, specially for when you need compute at a lower cost (when demand on the platform is lower). You don’t care so much for real-time results and don’t mind being evicted whenever cost rises. Similarly Azure Batch can give you low priority VM instances when the outcome of your processing is more important that it’s processing speed.

Subscription Management

There are different type of subscriptions available from Microsoft. You can choose to use the Retail plan (just sign up on Azure.com with your credit card) or to use a Cloud Service Provider (CSP). Different subscription types have different payment terms and pricing. Larger businesses and enterprises will choose to opt for the Enterprise Agreement (EA) account and subscriptions systems. Not-for-profits and charities may be applicable for discounts/sponsorship subscriptions and governments can use specific gov subscriptions and platforms. Reach out to your Microsoft account manager to get an overview of what best applies to you.

Regional differences

Pricing over the world differs as it does in most sectors. Different geographics have different underlying economic structures and operational costs, goods can be more expensive in country A vs B. Azure is no different.. some services can be more or less expensive depending on which region you’re running your resources in. For instance, using North Europe (based in Ireland) can have lower cost compared to West Europe (based in The Netherlands). Both are based in geographic Europe and comply to European Union law and standards yet the market conditions favor Ireland vs NL. The website AzurePrice.net gives insight in the cost per region. Do keep in mind that services offered in Azure can differ per region and stuff like networking is available per region. If you have virtual machines in both North Europe and West Europe regions, you can’t join them to the same virtual network. You’ll need Virtual Network peering, Virtual Network Gateways/vWAN to interconnect the different regions. Also keep networking latency, information processing laws and data residency compliance in mind when selecting the best region for your workload. Doing some labs and don’t care you’re on the other side of the world? Select North/South/West Central US for the lowest average cost.

Wrapping up

This post gave you some insights on how you can track your costs and further optimize the money you spend on Azure services. Please consider donating some of the possible savings to GirlsWhoCode or gift something nice to the people that matter most to you.

2021, for a lot people, wasn’t what most expected. Still I hope you made the best of it and take some time to recharge this festive period. Again I want to thank all my friends and family that have been so supportive this year and a big thanks to Pixel Robots (Richard Hooper) and Gregor Suttie organizing this great community event once more and inviting me to join. I wish everyone great health, joy and success for 2022!

Thank you for reading this post. Please head over to the Festive Tech Calendar for even more great content! If you want to see a related videorecording of a presentation I gave on this topic earlier this year at AzureLive, you can watch it below (starts at 1:56:50):