Skip to content

Latest commit

 

History

History

function-app-deployment-slot

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
description page_type products urlFragment languages
This template provisions a function app on a Premium plan with production slot and an additional deployment slot.
sample
azure
azure-resource-manager
function-app-deployment-slot
bicep
json

Azure Function App with a Deployment Slot

This sample Azure Resource Manager template deploys an Azure Function App with production slot and an additional deployment slot.

Deploy to Azure

OS

This template has a parameter functionPlanOS to choose Windows or Linux OS. Windows is selected by default. If you choose Linux, then parameter linuxFxVersion will be parameter, so you can skip it for Windows.

Elastic Premium Plan

The Azure Function app provisioned in this sample uses an Azure Functions Elastic Premium plan.

  • Microsoft.Web/serverfarms: The Azure Functions Premium plan (a.k.a. Elastic Premium plan)

Azure Function App

The Function App uses the AzureWebJobsStorage and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING app settings to connect to a Storage Account.

  • Microsoft.Web/sites: The function app instance.

Deployment Slot

Azure Functions deployment slots allow your function app to run different instances called "slots". Slots are different environments exposed via a publicly available endpoint. One app instance is always mapped to the production slot, and you can swap instances assigned to a slot on demand.

Function apps running under the Apps Service plan may have multiple slots, while under the Consumption plan only one slot is allowed.

For Windows, do not need to set the WEBSITE_CONTENTSHARE setting in a deployment slot. This setting is generated for you when the app is created in the deployment slot.

  • Microsoft.Web/sites/slots: The deployment slot for the function app.

For swapping the 2 slots, it is recommended to have 2 separate templates:

  1. First run this template successfully for deploying to slot using ZipDeploy.
  2. Then run this template for swapping slots.

ZipDeploy Extension

The Zip Deploy extension is added for "deployment" slot along with recommended app setting WEBSITE_RUN_FROM_PACKAGE=1 to mount the zip package for deployment. This is the recommended path for deployment, except for Linux Consumption Plan

  • Microsoft.Web/sites/slots/extensions: The ZipDeploy extension for "deployment" slot.

Azure Storage account

The Storage account that the Function uses for operation and for file contents.

Application Insights

Application Insights is used to provide monitor the Azure Function.

  • Microsoft.Insights/components: The Application Insights instance used by the Azure Function for monitoring.

Tags: Microsoft.Storage/storageAccounts, microsoft.insights/components, Microsoft.Web/serverfarms, Microsoft.Web/sites, Microsoft.Web/sites/slots