Edit

Configure zone redundancy for Azure Functions

Zone redundancy enables your function apps to be resilient to problems in Azure availability zones, so your app remains available when a datacenter or zone has an outage. This article provides step-by-step guidance for configuring Azure Functions to be zone-redundant, depending on your hosting plan. For information about how availability zones work with Azure Functions, see Reliability in Azure Functions.

Availability zone configuration for Azure Functions depends on your Functions hosting plan:

Hosting plan Support level Configuration section
Flex Consumption plan GA Select Flex Consumption at the top of this article.
Elastic Premium plan GA Select Premium at the top of this article.
Dedicated (App Service) plan GA See Configure availability zones for App Service.
Consumption plan n/a Not supported by the Consumption plan.

Note

The content in this article isn't relevant to the currently selected hosting plan. To choose a different plan, use the selector at the top of this article. For a comparison of all hosting plans, see Azure Functions hosting options.

Zone redundancy isn't supported in the Consumption plan. Consider migrating to the Flex Consumption plan or Premium plan for availability zone support.

Note

The content in this article isn't relevant to the currently selected hosting plan. To choose a different plan, use the selector at the top of this article. For a comparison of all hosting plans, see Azure Functions hosting options.

For Dedicated (App Service) plan zone redundancy configuration, see Configure availability zones for App Service.

Note

The content in this article isn't relevant to the currently selected hosting plan. To choose a different plan, use the selector at the top of this article. For a comparison of all hosting plans, see Azure Functions hosting options.

When running functions on Azure Container Apps, availability zone redundancy is configured at the Container Apps environment level. See Reliability in Azure Container Apps.

Important

Before configuring zone redundancy, review the requirements and details listed in Reliability in Azure Functions - Resilience to availability zone failures.

Important

Before configuring zone redundancy, review the requirements and details listed in Reliability in Azure Functions - Resilience to availability zone failures.

You can enable or disable availability zones on existing Elastic Premium plans using the Azure CLI. For more information, including important details about Elastic Premium-specific capacity behaviors, see Enable zone redundancy on an existing plan.

View regions that support availability zones

You can deploy zone-redundant apps to a Flex Consumption plan only in specific regions. To see the current list of supported regions, use Azure CLI:

  1. If you didn't already, install Azure CLI and sign in to Azure.

    az login
    
  2. Use the az functionapp list-flexconsumption-locations command with the --zone-redundant=true argument. This command returns a list of regions that currently support zone-redundant Flex Consumption plans:

    az functionapp list-flexconsumption-locations --zone-redundant=true --query "sort_by(@, &name)[].{Region:name}" -o table
    

Create a zone-redundant function app

Follow these steps to create a zone-redundant Flex Consumption plan when you create your app.

  1. To create a function app in a zone-redundant plan, you must have an existing zone-redundant storage account. If you don't already have a zone-redundant storage account, create one before you proceed.

  2. In the Azure portal, go to Create Function App. For more information about creating a function app in the portal, see Create a function app.

  3. Select Flex Consumption and then select the Select button.

  4. On the Create Function App (Flex Consumption) page, on the Basics tab, enter the settings for your function app. Pay special attention to the settings in the following table (also highlighted in the following screenshot), which have specific requirements for zone redundancy.

    Setting Suggested value Notes for zone redundancy
    Region Your preferred supported region The region in which your Flex Consumption plan is created. For a list of regions that support zone redundancy for Azure Functions Premium plans, see Reliability in Azure Functions - Resilience to availability zone failures - Requirements.
    Zone redundancy Enabled This setting specifies whether your app is zone redundant. You can only select Enabled when you've chosen a region that supports zone redundancy.

    Screenshot of the Basics tab of the Flex Consumption function app create page.

  5. On the Storage tab, select the zone-redundant storage account for your function app. Pay special attention to the setting in the following table, which has specific requirements for zone redundancy.

    Setting Suggested value Notes for zone redundancy
    Storage account A zone-redundant storage account As described in the reliability guide for Azure Functions, use a zone-redundant storage account for your zone-redundant function app.
  6. For the rest of the function app creation process, create your function app as normal. There are no settings in the rest of the creation process that affect zone redundancy.

After you create and deploy the zone-redundant plan, the Flex Consumption function app hosted on your new plan is considered zone-redundant.

Follow these steps to create a zone-redundant Premium plan and app.

  1. In the Azure portal, go to Create Function App. For more information about creating a function app in the portal, see Create a function app.

  2. Select Functions Premium and then select Select.

  3. On Create Function App (Functions Premium), on the Basics tab, enter the settings for your function app. Pay special attention to the settings in the following table (also highlighted in the following screenshot), which have specific requirements for zone redundancy.

    Setting Suggested value Notes for zone redundancy
    Region Your preferred supported region The region in which you create your Elastic Premium plan. Pick a region that supports availability zones. For a list of regions that support zone redundancy for Azure Functions Premium plans, see Reliability in Azure Functions - Resilience to availability zone failures - Requirements.
    Pricing plan One of the Elastic Premium plans. For more information, see Available instance SKUs. This article describes how to create a zone redundant app in a Premium plan. Zone redundancy isn't currently available in Consumption plans. For information on zone redundancy on App Service plans, see Configure availability zones for App Service.
    Zone redundancy Enabled This setting specifies whether your app is zone redundant. You can't select Enabled unless you choose a region that supports zone redundancy, as described previously.

    Screenshot of the Basics tab of the function app create page.

  4. On the Storage tab, enter the settings for your function app storage account. Pay special attention to the setting in the following table, which has specific requirements for zone redundancy.

    Setting Suggested value Notes for zone redundancy
    Storage account A zone-redundant storage account As described in the reliability guide for Azure Functions, use a zone-redundant storage account for your zone-redundant function app.
  5. For the rest of the function app creation process, create your function app as normal. There are no settings in the rest of the creation process that affect zone redundancy.

After you create and deploy the zone-redundant plan, any function app you host on your new plan is considered zone-redundant.

Enable zone redundancy on an existing plan

Changing the zone redundancy of your app requires a restart, which causes downtime in your app. Before updating your Flex Consumption plan to be zone-redundant, update the default host storage account to also be zone redundant.

Tip

If you use a separate storage account for the app's deployment container, update it to be zone redundant as well.

Use these steps to prepare your storage accounts for the change:

  1. Review Storage Considerations.
  2. Create or identify a zone-redundant storage account to be the default host storage account for the app.
  3. Update the storage-related application settings of the app, like AzureWebJobsStorage, to reference the zone-redundant storage account. See Work with application settings.
  4. Update the deployment storage account for the app, which can be the same or different as the storage account associated with the app. See Configure deployment settings.

After you update the storage accounts used by your app, update the Flex Consumption plan to be zone-redundant.

  1. In the Azure portal, search for and select the function app to update.

  2. Under Settings, select Scale and Concurrency.

  3. On the Zone redundancy tab, check Add zone redundancy to enable the feature. If already checked, you can uncheck this box to disable the feature.

  4. Select Save to commit your changes and restart the app.

Screenshot of the Scale and Concurrency tab of a Flex Consumption function app.

Keep these important considerations in mind before you enable zone redundancy in your Premium plan hosted app:

  • The zoneRedundant property of an Elastic Premium plan is mutable, so you can toggle availability zone support without creating a new plan.

  • Unlike in a Dedicated (App Service) plan, an Elastic Premium capacity behavior (sku.capacity) for each app is derived from app-level settings not just the plan setting.

  • To enable zone redundancy, you must update settings at both the plan level and the app level:

    Level Property Required value Notes
    Plan zoneRedundant true Enables availability zone distribution
    Plan sku.capacity 2 or higher Sets the intended minimum instance count
    App (each) minimumElasticInstanceCount 2 or higher The control plane sets plan sku.capacity to the highest value across all apps. Setting sku.capacity alone doesn't enforce a minimum, so you must also set this app-level property.
  • You can't currently configure availability zone redundancy on existing Elastic Premium plans from the portal.

To enable availability zone redundancy in your Premium plan app:

Not currently supported, choose another tab.

Verify instance zone placement

After you enable zone redundancy, you can confirm that your function app instances are distributed across availability zones by using either the Azure portal or Azure CLI.

In the Azure portal, go to your function app. Under Settings, select Instances. The Instances page shows each running instance and the availability zone it's placed in.

Troubleshooting

If zone redundancy isn't working as expected after following these steps, check the following items:

  • Confirm that minimumElasticInstanceCount is set to at least 2 on each app.

  • For issues related to scale units and SKU requirements, review the Common Issues and Solutions section in the deep dive blog post on Availability Zones in Azure App Service.

Next steps