Azure Function Timeout

Let’s discuss Azure Function Timeout details and how to increase Azure Function Timeout.

Azure Function Timeout

Ultimately, the Azure Function Timeout is based on the Azure Function Plan or Pricing tier you use to host your Azure Function App. Below are the details on the timeout duration based on the Azure Function plan type and the maximum extended time-out duration for your Azure Function App you can configure.

  • As per the Consumption Plan, the default time out for the Azure Function is 5 minutes, and you can configure up to 10 minutes maximum in the case of this plan.
  • In the case of the Azure Function Premium Plan, the default time out for the Azure Function is 30 minutes, and you can configure a maximum of up to 60 minutes as per this plan.
  • Based on the Azure Function App Service Plan, the default timeout for your Azure Function is 30 minutes, and you can configure a maximum of up to No Limit as per this plan.

The table below shows you the default timeout option based on your Azure Function App plan.

PlanRuntime VersionMaximum Time-out duration you can updateMaximum Time out duration you can update
For Consumption PlanIf you are using Runtime version 1.x5 minutesYou can set the maximum time out as 10 minutes
For Consumption PlanIf you are using Runtime version 2.x5 minutesYou can set the maximum time out as 10 minutes
For Consumption PlanIf you are using Runtime version 3.x5 minutesYou can set the maximum time out as 10 minutes
For Premium PlanIf you are using Runtime version 1.x30 minutesYou can set the unlimited maximum time-out
For Premium PlanIf you are using Runtime version 2.x30 minutesYou can set the unlimited maximum time out
For Premium PlanIf you are using Runtime version 3.x30 minutesYou can set the unlimited maximum time-out
For App Service PlanIf you are using Runtime version 1.xUnlimitedYou can set the unlimited maximum time-out
For App Service PlanIf you are using Runtime version 2.x30You can set the unlimited maximum time-out
For App Service PlanIf you are using Runtime version 3.x30You can set the unlimited maximum time out

How to increase Azure Function Timeout

If you wish to increase Azure function timeout, you must configure the Azure function timeout settings In the Host.JSON file to the maximum value based on your Azure Function Plan.

Suppose you want to configure your Azure function timeout limit to the maximum duration. In that case, you need to set the functionTimeout property value to a maximum time duration in the host.json file like the one below.

Note: Specify one “functionTimeout ” property based on your Azure Function Plan under which your Azure Function is running.

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
          "samplingSettings": {
            "isEnabled": true,
            "excludedTypes": "Request",
            "functionTimeout": "00:10:00", //In case of the Consumption Plan max 10 minute
            "functionTimeout": "01:00:00", //In case of the Premium Plan max 60 minute
            "functionTimeout": "-1"        //"No Limit" in the case of the Azure Function App Service Plan
          }
        }
    }
}

You are done with the changes. Similarly, you can edit the host.json file in the Azure Portal itself.

Edit host.json File In Azure Portal

You can also edit the host.json file in the Azure Portal Itself by following the below steps to update the Azure function timeout value.

Login to the Azure Portal (https://portal.azure.com/)

Navigate to the Azure Function App and click on the App Service Editor (Preview) from the left navigation on the Azure Function App page.

azure function timeout settings

Click on the Go –> button from the below window.

How to Access host.json File In Azure Portal

You can find the host.json file under the wwwroot directory. By default, you will not get the functiontimeout property in the host.json file.

You can add the functionTimeout property to set the maximum time out. One suggestion here is if you are configuring this property in the Development and Testing environment, it is fine. Still, in the Production environment, it’s not a suggestable approach.

 {
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request",
                 "functionTimeout": "00:10:00"
            }
        }
    }
}
azure function timeout host.json