Serverless computing is a growing trend in cloud computing, and it’s a natural next step in the Platform as a Service (PaaS) area. First PaaS allowed applications to be hosted without requiring Virtual Machines to manage, then serverless computing further removes the construct of a server. Azure Functions is the service within the Microsoft Azure cloud that offers serverless hosting and execution of application code. With serverless architecture removing the construct of a server from the equation of application hosting the concept of pricing begins to get a little fuzzy. This articles explains how Azure Functions pricing works.

Azure Functions is available with the 2 following pricing methods:

Dynamic Hosting Plan

functions_colorWith Dynamic hosting, Azure Functions completely abstracts away the server construct. You no longer pay for reserving CPU Cores and RAM of the underlying Virtual Machine (VM). You only pay for the time your code runs, and not for the time it remains idle.

azurefunctions_hostingplan_dynamicWhen provisioning Azure Functions in Microsoft Azure, the App Service Plan option of Dynamic will configure the use of the Dynamic Hosting Plan. Rather than specifying the CPU Cores and RAM of the underlying VM, the Dynamic Hosting Plan specifies the Memory Allocation to reserve for the Azure Functions service while it is running.

The options for Memory Allocation range from 128 MB on the bottom all the way up to a maximum of 1.5 GB of memory.

You only pay when the Azure Function is run.

When Azure Functions execute the scalability of the application code is handled automatically behind the scenes by the service without the need to configure any Autoscaling or even manually scaling the App Service Instance like would be needed if the same code were hosted in an Azure App Service WebJob.

Further details on the specifics of Azure Functions pricing can be found on the official Azure Functions pricing page.

Classic / App Service Plan

appservice_colorWith Classic hosting, Azure Functions runs on top of an Azure App Service Plan. With this method the Platform as a Service (PaaS) Virtual Machine (VM) under the covers remains reserved. The CPU Cores and RAM of the VM still need to be specified as they are reserved for the instance size the same as with any other Azure App Service; such as Azure Web Apps or API Apps.

azurefunctions_hostingplan_classicWhen provisioning Azure Functions in Microsoft Azure, the App Service Plan option of Classic will configure the use of an App Service Plan for hosting the Azure Functions. The underlying Virtual Machine (VM) will be reserved just like any other Azure App Service Plan service (Web Apps, API Apps, and Mobile Apps).

Azure Functions can run in an App Service Plan of another resource without incurring additional compute costs.

The Classic hosting plan option for Azure Functions exists for the purpose of hosting Azure Functions along-side other App Service resources running in an App Service Plan. While it may not be practical to host Azure Functions in a VM Instance in an App Service Plan if that’s the only resource being hosted, since it would cost much more than if Dynamic were used instead.

By using Classic hosting plan, the Azure Functions can run within an App Service VM Instance, thus allowing for even further cost savings by utilizing over provisioned resources of an existing App Service Plan VM Instance. In other words, if the Azure Web App being hosted doesn’t exactly need all the CPU Cores and RAM allocated to it, then hosting Azure Functions here will utilize what’s already being paid for without incurring additional computer costs.

Further details on the specifics of Azure App Service pricing can be found on the official Azure App Service pricing page.

5 thoughts on “How Azure Functions Pricing Works

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s