Azure Function App Execution Times
With Azure Functions, you can run code in the Cloud, i.e. code executes in a runtime hosted in an App Service. When provision your Function App, the container for one or more functions, you can choose between ‘Pay as you go’ or an App Service Plan (meaning you dimension the host for your functions). The costs are detailed in the tip ‘Hosting Costs’.
Provisioning your Function App as ‘Pay as you go’ means you do not have to worry about any infrastructure, scaling and only pay when the code runs based on execution time. Nevertheless, the execution time in a ‘pay as you go’ Function App or Serverless manner as it adheres to that paradigm of not maintaining servers, auto scale and micro billing, the execution time is 5 minutes max by default.
You can configure the functionTimeout in the host.json file to change the maximum duration of the execution time. In the Azure Portal, you can select you Function App, which contains your functions and under App Files, you can see the host.json file, which allows you to add or change properties.
In case you decide when provisioning a Function App with the Premium plan instead of consumption the default execution time is 30 minutes, which you change to between 1 minute (minimum) and 60 minutes (maximum). Furthermore, when choosing an App Service Plan (dedicated), the default is again 30 minutes; however, there is no limit for the maximum (set the value to -1).
To conclude, when designing functions for your workloads, you need to consider execution times of them. Each tier (Consumption, Premium, and App Service Plan) has a different maximum duration in execution times – except for the App Service Plan.