A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/azure/azure-functions/functions-deployment-slots below:

Azure Functions deployment slots | Microsoft Learn

Azure Functions deployment slots allow your function app to run different instances called slots. Slots are different environments exposed by using 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.

The number of available slots depends on your specific hosting option:

The following descriptions reflect how functions are affected by swapping slots:

Why use slots?

There are many advantages to using deployment slots, including:

Swap operations

During a swap, one slot is considered the source and the other is the target. The source slot has the instance of the application that is applied to the target slot. The following steps ensure the target slot doesn't experience downtime during a swap:

  1. Apply settings: Settings from the target slot are applied to all instances of the source slot. For example, the production settings are applied to the staging instance. The applied settings include the following categories:

  2. Wait for restarts and availability: The swap waits for every instance in the source slot to complete its restart and to be available for requests. If any instance fails to restart, the swap operation reverts all changes to the source slot and stops the operation.

  3. Update routing: If all instances on the source slot are warmed up successfully, the two slots complete the swap by switching routing rules. After this step, the target slot (for example, the production slot) has the app that was previously warmed up in the source slot.

  4. Repeat operation: Now that the source slot has the preswap app previously in the target slot, complete the same operation by applying all settings and restarting the instances for the source slot.

Keep in mind the following points:

Manage settings

Some configuration settings are slot-specific. The following lists detail which settings change when you swap slots, and which remain the same.

Slot-specific settings:

Non slot-specific settings:

Features marked with an asterisk (*) don't get swapped, by design.

Note

Certain app settings that apply to unswapped settings are also not swapped. For example, since diagnostic settings aren't swapped, related app settings like WEBSITE_HTTPLOGGING_RETENTION_DAYS and DIAGNOSTICS_AZUREBLOBRETENTIONDAYS are also not swapped, even if they don't show up as slot settings.

Create a deployment setting

You can mark settings as a deployment setting, which makes it sticky. A sticky setting doesn't swap with the app instance.

If you create a deployment setting in one slot, make sure to create the same setting with a unique value in any other slot that is involved in a swap. This way, while a setting's value doesn't change, the setting names remain consistent among slots. This name consistency ensures your code doesn't try to access a setting that is defined in one slot but not another.

Use the following steps to create a deployment setting:

  1. Navigate to Deployment slots in the function app, and then select the slot name.

  2. Select Configuration, and then select the setting name you want to stick with the current slot.

  3. Select Deployment slot setting, and then select OK.

  4. Once setting section disappears, select Save to keep the changes

Deployment

Slots are empty when you create a slot. You can use any of the supported deployment technologies to deploy your application to a slot.

Scaling

All slots scale to the same number of workers as the production slot.

View slots

You can view information about existing slots using either the Azure CLI or through the Azure portal.

Use these steps to create a new slot in the portal:

  1. Navigate to your function app.

  2. Select Deployment slots and the existing slots are shown.

Run this az functionapp deployment slot list command to list the existing slots in your function app:

az functionapp deployment slot list --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>"
Add a slot

You can add a slot using either the Azure CLI or through the Azure portal.

Use these steps to create a slot in the portal:

  1. Navigate to your function app.

  2. Select Deployment slots, and then select + Add Slot.

  3. Type the name of the slot and select Add.

Run the az functionapp deployment slot create command to create a slot named staging in your function app:

az functionapp deployment slot create --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot staging

You can also create a slot by using ARM templates or Bicep files. For an example of how to create a function app in a Consumption plan with a deployment slot, see this Azure Resource Manager quickstart.

Access slot resources

You access resources (HTTP triggers and administrator endpoints) in a staging slot in the same way as the production slot. However, instead of the function app host name you use the slot-specific host name in the request URL, along with any slot-specific keys. Because staging slots are live apps, you must secure your functions in a staging slot as you would in the production slot.

Swap slots

You can swap slots in an out of production using either the Azure CLI or through the Azure portal.

Use these steps to swap a staging slot into production:

  1. Navigate to the function app.

  2. Select Deployment slots, and then select Swap.

  3. Verify the configuration settings for your swap and select Swap.

The swap operation can take a few seconds.

Run this az functionapp deployment slot swap command to swap between a slot named staging and the production slot in your function app:

az functionapp deployment slot swap --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot staging --target-slot production
Roll back a swap

If a swap results in an error or you simply want to "undo" a swap, you can roll back to the initial state. To return to the preswapped state, do another swap to reverse the swap.

Remove a slot

You can remove a slot using either the Azure CLI or through the Azure portal.

Use these steps to remove a slot from your app in the portal:

  1. Navigate to Deployment slots in the function app, and then select the slot name.

  2. Select Delete.

  3. Type the name of the deployment slot you want to delete, and then select Delete.

  4. Close the confirmation pane.

Run the az functionapp deployment slot delete command to remove a slot named staging from your function app:

az functionapp deployment slot delete --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot staging
Change App Service plan

With a function app that is running under an App Service plan, you can change the underlying App Service plan for a slot.

Note

You can't change a slot's App Service plan under the Consumption plan.

Use the following steps to change a slot's App Service plan:

  1. Navigate to Deployment slots in the function app, and then select the slot name.

  2. Under App Service plan, select Change App Service plan.

  3. Select the plan you want to upgrade to, or create a new plan.

  4. Select OK.

Considerations

Azure Functions deployment slots have the following considerations:

Next steps

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4