Question

Difficulty: MediumCreate and Configure Azure Functions

An organization has a data-processing pipeline that runs on a V4 Azure Function App using the Consumption hosting plan. A specific HTTP-triggered function in the app usually processes webhooks in under 2 minutes. However, during periodic bulk uploads, the execution time for some requests increases to approximately 8 minutes, causing the executions to time out and fail. You need to adjust the function app configuration to allow a maximum execution duration of 8 minutes for these long-running requests without migrating to a different hosting plan. How should you configure the function app?

  1. A
    Migrate the function app to an App Service (Dedicated) plan, as the Consumption plan has a non-customizable execution limit of 5 minutes.
  2. Modify the host.json configuration file at the root of the function app to include the functionTimeout property set to '00:08:00'.Answer
  3. C
    Add an application setting named WEBSITE_RUN_TIMEOUT with a value of 480 using the Key Vault reference syntax @Microsoft.KeyVault(SecretUri=...).
  4. D
    Configure an App Service autoscale rule using Azure Monitor metrics to scale out the instances, which automatically extends the maximum execution window per function.

Answer

Modify the host.json configuration file at the root of the function app to include the functionTimeout property set to '00:08:00'.
The correct action is to modify the host.json configuration file at the root of the function app by setting the 'functionTimeout' property to '00:08:00'. In Azure Functions V4, the Consumption plan has a default timeout of 5 minutes, but it can be configured up to a maximum of 10 minutes. Because 8 minutes is within the maximum limit, migrating to another hosting plan is not required.

Step-by-Step Solution

1
Determine the current hosting plan and its execution duration limits.
The function app is on the Consumption plan, which has a default timeout of 5 minutes and a maximum timeout of 10 minutes.
Since 8 minutes is under the 10-minute maximum limit, the requirement can be met on the Consumption plan without migrating the hosting plan.
2
Identify the configuration file and setting used to manage execution timeout in Azure Functions V4.
The 'functionTimeout' setting in the host.json file at the root of the function app configures the execution timeout.
Application settings (like local.settings.json or custom app settings) or autoscale rules are not used to configure the function execution duration timeout.
3
Apply the correct time format to the functionTimeout property.
Set 'functionTimeout' to '00:08:00' in the host.json file.
The value must be formatted as a timespan (hh:mm:ss).

Key Concept

Configuring execution timeout in host.json for Azure Functions V4
Estimated Time:1m 30s
Rate this question