How to pay MORE with Azure Functions?

This post is based on my recent calculations regarding a new version of an old project I'm about to develop for one of my clients. I'm aiming at a perfect balance between performance, flexibility and overall cost. To make things easier, I'll assume, that the fixed limit of a monthly bill for a solution is 50 EUR. I'll show you how easily you can overestimate Consumption Plan pricing model and pay much that you're about to.


Azure Functions pricing is somehow pretty straightforward:

  • €0.000014/GB-s
  • €0.169 per million executions

Of course we have a free grant of 400.000 GB-s and 1M of executions. Pretty sweet! It's gonna to be ultra cheap!


This is the expected load we're going to handle:

  • 150k executions per hour
  • less than 100 ms for an execution
  • each execution should use less than 128MB of memory

After a quick calculation those are the numbers we're interested in:

  • 108M executions per month
  • 1,35M GB-s

Total cost will be:

108M*0.169 + 1,35M*0.000014 = 18.083 + 13,03 = 31,383 EUR

Of course I've taken into account free grant. 


While paying something like 30 EUR per month for 108M execution is not a big deal, I'd like to focus on a few gotchas here. When calculating cost for Azure Functions, you have to remember, that there's minimum execution time, which is roughly 100ms and 128MB of memory used. What does it mean? Well, there's a little point in struggling to go below 100ms. On the other hand, you should fight for each and every milisecond above this threshold.

Another thing is how memory used is calculated - during each function execution consumption is calculated by taking the value of memory used and rounding it up to the nearest 128MB. This means, that if you consume each time 129MBs, you will be billed as you'd consume 256MBs. 

Let's check what happens if my function exceeds the limit of 128MBs:

108M*0.169 + 1,35M*0.000014 = 18.083 + 32,2 = 50,283 EUR

So it's extra 20 EUR per month. Please take into consideration, that we're talking about about a simple app, which handles merely 40 requests per second.


So what now? Is Consumption Plan really for me? Well - it all depends on your needs. Of of its best features is the possibility to scale cost with your application's growth. On the other hand maybe you need to execute tiny functions, which seem to cost too much because of lower limits for execution? In such scenario it'd viable to use App Service Plan and just pay a fixed price(or maybe reuse it and host both simple web application and use computation power for Azure Functions).

With the current pricing you could select between S1, B1 and B2 instances and still have plenty of additional features. 


Being aware of how a service works(and what is even more important - how its pricing works) can be crucial in enteprise scenarios, where you have high load and each milisecond and MB matters. Imagine situation, where a simple optimization(like adjusted algorithm, updated package to the newest version) could lead to e.g. 10 EUR savings per each function per month. If you multiply this by hundreds of functions and twelve months, you could end up saving thousands EURs each year. This is of course the most happy path, but in many cases being aware of the full cost changes mindset for real.

Real cost of developing a project in Azure

Recently I've moved one of my side projects fully to the cloud. In this short post I'd like to show you what is the real cost of developing a fairly small yet multi-dimensional project and how Azure gives me and my client flexibility to select what is really needed in this particular moment.

The project

I won't go into details here. Just to make a long story short - we're gathering data from many electronic devices and then provide reports based on different time intervals, places and custom properties to the clients. There's also a need to handle the old legacy system and migrate data from the old database to the new one.

Azure components

Mentioned project is built using following elements:

  • Storage account
  • Function App
  • 2x Web App
  • SQL database
  • Azure B2C
  • Application Insights

worth mentioning here is the fact, that by default we're using free tiers for Web Apps and SQL server.

Taking into consideration all above our monthly cost of developing this project is 1,50 EUR on average.


Because we're using free tiers, we have to be aware of limits - like available CPU minutes per day - but on the other hand, there's no problem to scale up when needed. This is what really made us into cloud - if only small features are being developed, free tier is more than enough. If we're during a strenuous period of developing new features, we can just go to the portal and change a tier.

Additionally we have to be aware, that on production we won't be able to use free versions of Azure components because of lacking features and much higher traffic. On the other hand, saving money in such way instead of paying much more money for resources we won't be able to utilize is a much smarter decision.

Detailed cost

There're two resources which make the most of our cost: Storage account and Function App. This is because they're the "hot path" in the system - one of the functions fetches data from FTP and pushes each record to a queues. Other functions take data from queues and perform some transformations, store data and push it further. When I checked my Billing page, the cost looks like this:

  • Storage account 0,62 EUR
  • Function App 0,55 EUR
  • B2C 0,09EUR
  • The rest of resources 0 EUR

We didn't need more power this month so we could keep the lowest cost possible.


Carefully designed cloud solution could really lower monthly cost of developing a project. On the other hand I've seen many examples, where developing a product in the cloud was much more expensive than an old-fashioned VM(or even a production environment also hosted somewhere in Azure!). Pay attention to resources used, selected tiers and their utilization and you won't be surprised when you see a bill at the end of a month.