Azure Functions hosting options
When you create a function app in Azure, you must choose a hosting plan for your app. There are three basic Azure Functions hosting plans provided by Azure Functions: Consumption plan, Premium plan, and Dedicated (App Service) plan. These hosting plans are facilitated by Azure App Service infrastructure and are generally available (GA) on both Linux and Windows virtual machines.
The Azure Functions hosting plan you choose dictates the following behaviors:
- How your function app is scaled.
- The resources available to each function app instance.
- Support for advanced functionality, such as Azure Virtual Network connectivity.
In addition to Azure Functions hosting, you can also host containerized function apps in containers can also be deployed to Kubernetes clusters and to Azure Container Apps. If you choose to host your functions in a Kubernetes cluster, consider using an Azure Arc-enabled Kubernetes cluster. To learn more about deploying custom container apps, see Azure Container Apps hosting of Azure Functions.
This article provides a detailed comparison between the various hosting plans, including container-based hosting options.
Note
Hosting Azure Functions containers on both Azure Arc-enabled Kubernetes clusters and Azure Container Apps is currently in preview.
Overview of plans
The following is a summary of the benefits of the three main Azure Functions hosting plans:
Plan | Benefits |
---|---|
Consumption plan | Scale automatically and only pay for compute resources when your functions are running. On the Consumption plan, instances of the Functions host are dynamically added and removed based on the number of incoming events. ✔ Default hosting plan. ✔ Pay only when your functions are running. ✔ Scales automatically, even during periods of high load. |
Premium plan | Automatically scales based on demand using pre-warmed workers, which run applications with no delay after being idle, runs on more powerful instances, and connects to virtual networks. Consider the Azure Functions Premium plan in the following situations: ✔ Your function apps run continuously, or nearly continuously. ✔ You have a high number of small executions and a high execution bill, but low GB seconds in the Consumption plan. ✔ You need more CPU or memory options than what is provided by the Consumption plan. ✔ Your code needs to run longer than the maximum execution time allowed on the Consumption plan. ✔ You require features that aren't available on the Consumption plan, such as virtual network connectivity. ✔ You want to provide a custom Linux image on which to run your functions. |
Dedicated plan | Run your functions within an App Service plan at regular App Service plan rates. Best for long-running scenarios where Durable Functions can't be used. Consider an App Service plan in the following situations: ✔ You have existing, underutilized VMs that are already running other App Service instances. ✔ Predictive scaling and costs are required. |
The comparison tables in this article also include the following hosting options, which provide the highest amount of control and isolation in which to run your function apps.
Hosting option | Details |
---|---|
ASE | App Service Environment (ASE) is an App Service feature that provides a fully isolated and dedicated environment for securely running App Service apps at high scale. ASEs are appropriate for application workloads that require: ✔ Very high scale. ✔ Full compute isolation and secure network access. ✔ High memory usage. |
Azure Container Apps | Azure Container Apps is a fully managed environment that enables you to run microservices and containerized applications on a serverless platform. Azure Container Apps let you run your functions with the power of the underlying Azure Kubernetes Service (AKS) while removing the complexity of having to work with Kubernetes APIs. |
Kubernetes (Direct or Azure Arc) |
Kubernetes provides a fully isolated and dedicated environment running on top of the Kubernetes platform. Kubernetes is appropriate for application workloads that require: ✔ Custom hardware requirements. ✔ Isolation and secure network access. ✔ Ability to run in hybrid or multi-cloud environment. ✔ Run alongside existing Kubernetes applications and services. |
The remaining tables in this article compare the plans on various features and behaviors. For a cost comparison between dynamic hosting plans (Consumption and Premium), see the Azure Functions pricing page. For pricing of the various Dedicated plan options, see the App Service pricing page.
Operating system/runtime
The following table shows operating system and language support for the hosting plans.
Linux1,2 code-only |
Windows code-only | Linux1,2,3 Docker container |
|
---|---|---|---|
Consumption plan | C# JavaScript Java Python PowerShell Core TypeScript |
C# JavaScript Java PowerShell Core TypeScript |
No support |
Premium plan | C# JavaScript Java Python PowerShell Core TypeScript |
C# JavaScript Java PowerShell Core TypeScript |
C# JavaScript Java PowerShell Core Python TypeScript |
Dedicated plan | C# JavaScript Java Python TypeScript |
C# JavaScript Java PowerShell Core TypeScript |
C# JavaScript Java PowerShell Core Python TypeScript |
ASE | C# JavaScript Java Python TypeScript |
C# JavaScript Java PowerShell Core TypeScript |
C# JavaScript Java PowerShell Core Python TypeScript |
Kubernetes (direct) | n/a | n/a | C# JavaScript Java PowerShell Core Python TypeScript |
Azure Arc (Preview) | C# JavaScript Java Python TypeScript |
n/a | C# JavaScript Java PowerShell Core Python TypeScript |
1 Linux is the only supported operating system for the Python runtime stack.
2 PowerShell support on Linux is currently in preview.
3 Linux is the only supported operating system for Docker containers.
Function app timeout duration
The timeout duration for functions in a function app is defined by the functionTimeout
property in the host.json project file. This property applies specifically to function executions. After the trigger starts function execution, the function needs to return/respond within the timeout duration. For more information, see Improve Azure Functions performance and reliability.
The following table shows the default and maximum values (in minutes) for specific plans:
Plan | Default | Maximum1 |
---|---|---|
Consumption plan | 5 | 10 |
Premium plan | 302 | Unlimited |
Dedicated plan | 302 | Unlimited |
1 Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer. For longer processing times, consider using the Durable Functions async pattern or defer the actual work and return an immediate response.
2 The default timeout for version 1.x of the Functions runtime is unlimited.
Scale
The following table compares the scaling behaviors of the various hosting plans.
Maximum instances are given on a per-function app (Consumption) or per-plan (Premium/Dedicated) basis, unless otherwise indicated.
Plan | Scale out | Max # instances |
---|---|---|
Consumption plan | Event driven. Scale out automatically, even during periods of high load. Azure Functions infrastructure scales CPU and memory resources by adding additional instances of the Functions host, based on the number of incoming trigger events. | Windows: 200 Linux: 1001 |
Premium plan | Event driven. Scale out automatically, even during periods of high load. Azure Functions infrastructure scales CPU and memory resources by adding additional instances of the Functions host, based on the number of events that its functions are triggered on. | Windows: 100 Linux: 20-1002 |
Dedicated plan3 | Manual/autoscale | 10-30 |
ASE3 | Manual/autoscale | 100 |
Kubernetes | Event-driven autoscale for Kubernetes clusters using KEDA. | Varies by cluster |
1 During scale-out, there's currently a limit of 500 instances per subscription per hour for Linux apps on a Consumption plan.
2 In some regions, Linux apps on a Premium plan can scale to 100 instances. For more information, see the Premium plan article.
3 For specific limits for the various App Service plan options, see the App Service plan limits.
Cold start behavior
Plan | Details |
---|---|
Consumption plan | Apps may scale to zero when idle, meaning some requests may have additional latency at startup. The consumption plan does have some optimizations to help decrease cold start time, including pulling from pre-warmed placeholder functions that already have the function host and language processes running. |
Premium plan | Perpetually warm instances to avoid any cold start. |
Dedicated plan | When running in a Dedicated plan, the Functions host can run continuously, which means that cold start isn't really an issue. |
ASE | When running in a Dedicated plan, the Functions host can run continuously, which means that cold start isn't really an issue. |
Kubernetes | Depending on KEDA configuration, apps can be configured to avoid a cold start. If configured to scale to zero, then a cold start is experienced for new events. |
Service limits
Resource | Consumption plan | Premium plan | Dedicated plan | ASE | Kubernetes |
---|---|---|---|---|---|
Default timeout duration (min) | 5 | 30 | 301 | 30 | 30 |
Max timeout duration (min) | 10 | unbounded7 | unbounded2 | unbounded | unbounded |
Max outbound connections (per instance) | 600 active (1200 total) | unbounded | unbounded | unbounded | unbounded |
Max request size (MB)3 | 100 | 100 | 100 | 100 | Depends on cluster |
Max query string length3 | 4096 | 4096 | 4096 | 4096 | Depends on cluster |
Max request URL length3 | 8192 | 8192 | 8192 | 8192 | Depends on cluster |
ACU per instance | 100 | 210-840 | 100-840 | 210-2508 | AKS pricing |
Max memory (GB per instance) | 1.5 | 3.5-14 | 1.75-14 | 3.5 - 14 | Any node is supported |
Max instance count (Windows/Linux) | 200/100 | 100/20 | varies by SKU9 | 1009 | Depends on cluster |
Function apps per plan | 100 | 100 | unbounded4 | unbounded | unbounded |
App Service plans | 100 per region | 100 per resource group | 100 per resource group | - | - |
Deployment slots per app10 | 2 | 3 | 1-209 | 20 | n/a |
Storage5 | 5 TB | 250 GB | 50-1000 GB | 1 TB | n/a |
Custom domains per app | 5006 | 500 | 500 | 500 | n/a |
Custom domain SSL support | unbounded SNI SSL connection included | unbounded SNI SSL and 1 IP SSL connections included | unbounded SNI SSL and 1 IP SSL connections included | unbounded SNI SSL and 1 IP SSL connections included | n/a |
1 By default, the timeout for the Functions 1.x runtime in an App Service plan is unbounded.
2 Requires the App Service plan be set to Always On. Pay at standard rates.
3 These limits are set in the host.
4 The actual number of function apps that you can host depends on the activity of the apps, the size of the machine instances, and the corresponding resource utilization.
5 The storage limit is the total content size in temporary storage across all apps in the same App Service plan. Consumption plan uses Azure Files for temporary storage.
6 When your function app is hosted in a Consumption plan, only the CNAME option is supported. For function apps in a Premium plan or an App Service plan, you can map a custom domain using either a CNAME or an A record.
7 Guaranteed for up to 60 minutes.
8 Workers are roles that host customer apps. Workers are available in three fixed sizes: One vCPU/3.5 GB RAM; Two vCPU/7 GB RAM; Four vCPU/14 GB RAM.
9 See App Service limits for details.
10 Including the production slot.
Limitations for creating new function apps in an existing resource group
In some cases, when trying to create a new hosting plan for your function app in an existing resource group you may receive one of the following errors:
- The pricing tier is not allowed in this resource group
- <SKU_name> workers are not available in resource group <resource_group_name>
This can happen when the following conditions are met:
- You create a function app in an existing resource group that has ever contained another function app or web app.
- Your new function app is created in the same region as the previous app.
- The previous app is in some way incompatible with your new app. This can happen between SKUs, operating systems, or due to other platform-level features, such as availability zone support.
The reason this happens is due to how function app and web app plans are mapped to different pools of resources when being created. Different SKUs require a different set of infrastructure capabilities. When you create an app in a resource group, that resource group is mapped and assigned to a specific pool of resources. If you try to create another plan in that resource group and the mapped pool does not have the required resources, this error will occur.
When this error occurs, instead create your function app and hosting plan in a new resource group.
Networking features
Feature | Consumption plan | Premium plan | Dedicated plan | ASE |
---|---|---|---|---|
Inbound IP restrictions | ✅Yes | ✅Yes | ✅Yes | ✅Yes |
Inbound Private Endpoints | ❌No | ✅Yes | ✅Yes | ✅Yes |
Virtual network integration | ❌No | ✅Yes (Regional) | ✅Yes (Regional and Gateway) | ✅Yes |
Virtual network triggers (non-HTTP) | ❌No | ✅Yes | ✅Yes | ✅Yes |
Hybrid connections (Windows only) | ❌No | ✅Yes | ✅Yes | ✅Yes |
Outbound IP restrictions | ❌No | ✅Yes | ✅Yes | ✅Yes |
Billing
Plan | Details |
---|---|
Consumption plan | Pay only for the time your functions run. Billing is based on number of executions, execution time, and memory used. |
Premium plan | Premium plan is based on the number of core seconds and memory used across needed and pre-warmed instances. At least one instance per plan must always be kept warm. This plan provides the most predictable pricing. |
Dedicated plan | You pay the same for function apps in an App Service Plan as you would for other App Service resources, like web apps. |
App Service Environment (ASE) | There's a flat monthly rate for an ASE that pays for the infrastructure and doesn't change with the size of the ASE. There's also a cost per App Service plan vCPU. All apps hosted in an ASE are in the Isolated pricing SKU. |
Kubernetes | You pay only the costs of your Kubernetes cluster; no additional billing for Functions. Your function app runs as an application workload on top of your cluster, just like a regular app. |
Next steps
Feedback
Submit and view feedback for