You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-deployment-slots.md
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,24 @@
1
1
---
2
2
title: Azure Functions deployment slots
3
-
description: Learn to create and use deployment slots with Azure Functions
3
+
description: Learn to create and use deployment slots with Azure Functions by using the Azure portal or with Azure CLI.
4
4
ms.topic: conceptual
5
-
ms.date: 02/27/2024
5
+
ms.date: 05/07/2025
6
6
---
7
7
# Azure Functions deployment slots
8
8
9
-
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.
9
+
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.
10
10
11
11
The number of available slots depends on your specific hosting option:
12
12
13
13
| Hosting option | Slots (including production) |
14
-
| ---- | ---- |
14
+
| ---- | ---- |
15
15
|[Consumption plan](consumption-plan.md)| 2 |
16
16
|[Flex Consumption plan](flex-consumption-plan.md)| Not currently supported |
The following reflect how functions are affected by swapping slots:
21
+
The following descriptions reflect how functions are affected by swapping slots:
23
22
24
23
- Traffic redirection is seamless; no requests are dropped because of a swap. This seamless behavior occurs because the next function trigger is routed to the swapped slot.
25
24
- Currently executing function are terminated during the swap. To learn how to write stateless and defensive functions, see [Improve the performance and reliability of Azure Functions](performance-reliability.md#write-functions-to-be-stateless).
@@ -31,16 +30,17 @@ There are many advantages to using deployment slots, including:
31
30
-**Different environments for different purposes**: Using different slots gives you the opportunity to differentiate app instances before swapping to production or a staging slot.
32
31
-**Prewarming**: Deploying to a slot instead of directly to production allows the app to warm up before going live. Additionally, using slots reduces latency for HTTP-triggered workloads. Instances are warmed up before deployment, which reduces the cold start for newly deployed functions.
33
32
-**Easy fallbacks**: After a swap with production, the slot with a previously staged app now has the previous production app. If the changes swapped into the production slot aren't as you expect, you can immediately reverse the swap to get your "last known good instance" back.
34
-
-**Minimize restarts**: Changing app settings in a production slot requires a restart of the running app. You can instead change settings in a staging slot and swap the settings change into production with a prewarmed instance. Slots are the recommended way to migrate between Functions runtime versions while maintaining the highest availability. To learn more, see [Minimum downtime update](migrate-version-3-version-4.md#minimum-downtime-update).
33
+
-**Minimize restarts**: Changing app settings in a production slot requires a restart of the running app. You can instead change settings in a staging slot and swap the settings change into production with a prewarmed instance. Slots are the recommended way to migrate between Functions runtime versions while maintaining the highest availability. To learn more, see [Minimum downtime update](migrate-version-3-version-4.md#minimum-downtime-update).
35
34
36
35
## Swap operations
37
36
38
37
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:
39
38
40
39
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:
41
-
-[Slot-specific](#manage-settings) app settings and connection strings (if applicable)
-[App Service authentication](../app-service/overview-authentication-authorization.md) settings (if enabled)
44
44
45
45
1.**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.
46
46
@@ -56,7 +56,7 @@ Keep in mind the following points:
56
56
57
57
- Settings related to event sources and bindings must be configured as [deployment slot settings](#manage-settings)*before you start a swap*. Marking them as "sticky" ahead of time ensures events and outputs are directed to the proper instance.
58
58
59
-
- When you create a new staging slot, all existing settings from the production slot are created in the new slot, regardless of the *stickiness* of the setting.
59
+
- When you create a new staging slot, all existing settings from the production slot are created in the new slot, regardless of the *stickiness* of the setting.
60
60
61
61
## Manage settings
62
62
@@ -89,32 +89,32 @@ Some configuration settings are slot-specific. The following lists detail which
89
89
Features marked with an asterisk (*) don't get swapped, by design.
90
90
91
91
> [!NOTE]
92
-
> Certain app settings that apply to unswapped settings are also not swapped. For example, since diagnostic settings are not 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.
92
+
> 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.
93
93
>
94
94
95
95
### Create a deployment setting
96
96
97
-
You can mark settings as a deployment setting, which makes it _sticky_. A sticky setting doesn't swap with the app instance.
97
+
You can mark settings as a deployment setting, which makes it *sticky*. A sticky setting doesn't swap with the app instance.
98
98
99
99
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.
100
100
101
101
Use the following steps to create a deployment setting:
102
102
103
103
1. Navigate to **Deployment slots** in the function app, and then select the slot name.
104
104
105
-
:::image type="content" source="./media/functions-deployment-slots/functions-navigate-slots.png" alt-text="Find slots in the Azure portal." border="true":::
105
+
:::image type="content" source="./media/functions-deployment-slots/functions-navigate-slots.png" alt-text="Screenshot shows the deployments slots in the Azure portal." border="true":::
106
106
107
107
1. Select **Configuration**, and then select the setting name you want to stick with the current slot.
108
108
109
-
:::image type="content" source="./media/functions-deployment-slots/functions-configure-deployment-slot.png" alt-text="Configure the application setting for a slot in the Azure portal." border="true":::
109
+
:::image type="content" source="./media/functions-deployment-slots/functions-configure-deployment-slot.png" alt-text="Screenshot shows where to configure the application setting for a slot in the Azure portal." border="true":::
110
110
111
111
1. Select **Deployment slot setting**, and then select **OK**.
112
112
113
-
:::image type="content" source="./media/functions-deployment-slots/functions-deployment-slot-setting.png" alt-text="Configure the deployment slot setting." border="true":::
113
+
:::image type="content" source="./media/functions-deployment-slots/functions-deployment-slot-setting.png" alt-text="Screenshot shows where to configure the deployment slot setting." border="true":::
114
114
115
115
1. Once setting section disappears, select **Save** to keep the changes
116
116
117
-
:::image type="content" source="./media/functions-deployment-slots/functions-save-deployment-slot-setting.png" alt-text="Save the deployment slot setting." border="true":::
117
+
:::image type="content" source="./media/functions-deployment-slots/functions-save-deployment-slot-setting.png" alt-text="Screenshot shows how to save the deployment slot setting." border="true":::
118
118
119
119
## Deployment
120
120
@@ -137,8 +137,8 @@ Use these steps to create a new slot in the portal:
137
137
138
138
1. Navigate to your function app.
139
139
140
-
1. Select **Deployment slots** and the existing slots are shown.
141
-
140
+
1. Select **Deployment slots** and the existing slots are shown.
141
+
142
142
### [Azure CLI](#tab/azure-cli)
143
143
144
144
Run this [az functionapp deployment slot list](/cli/azure/functionapp/deployment/slot#az-functionapp-deployment-slot-list) command to list the existing slots in your function app:
@@ -161,11 +161,11 @@ Use these steps to create a slot in the portal:
161
161
162
162
1. Select **Deployment slots**, and then select **+ Add Slot**.
@@ -183,7 +183,7 @@ You access resources (HTTP triggers and administrator endpoints) in a staging sl
183
183
184
184
## Swap slots
185
185
186
-
You can swap slots in an out of production using either the [Azure CLI](/cli/azure) or through the [Azure portal](https://portal.azure.com).
186
+
You can swap slots in an out of production using either the [Azure CLI](/cli/azure) or through the [Azure portal](https://portal.azure.com).
187
187
188
188
### [Azure portal](#tab/azure-portal)
189
189
@@ -195,9 +195,9 @@ Use these steps to swap a staging slot into production:
195
195
196
196
:::image type="content" source="./media/functions-deployment-slots/functions-swap-deployment-slot.png" alt-text="Screenshot that shows the 'Deployment slot' page with the 'Add Slot' action selected." border="true":::
197
197
198
-
1. Verify the configuration settings for your swap and select **Swap**
198
+
1. Verify the configuration settings for your swap and select **Swap**.
199
199
200
-
:::image type="content" source="./media/functions-deployment-slots/azure-functions-deployment-slots-swap-config.png" alt-text="Swap the deployment slot." border="true":::
200
+
:::image type="content" source="./media/functions-deployment-slots/azure-functions-deployment-slots-swap-config.png" alt-text="Screenshot showing swapping the deployment slot." border="true":::
201
201
202
202
The swap operation can take a few seconds.
203
203
@@ -207,7 +207,7 @@ Run this [az functionapp deployment slot swap](/cli/azure/functionapp/deployment
207
207
208
208
```azurecli
209
209
az functionapp deployment slot swap --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot staging --target-slot production
210
-
```
210
+
```
211
211
---
212
212
213
213
## Roll back a swap
@@ -216,27 +216,27 @@ If a swap results in an error or you simply want to "undo" a swap, you can roll
216
216
217
217
## Remove a slot
218
218
219
-
You can remove a slot using either the [Azure CLI](/cli/azure) or through the [Azure portal](https://portal.azure.com).
219
+
You can remove a slot using either the [Azure CLI](/cli/azure) or through the [Azure portal](https://portal.azure.com).
220
220
221
221
### [Azure portal](#tab/azure-portal)
222
222
223
223
Use these steps to remove a slot from your app in the portal:
224
224
225
225
1. Navigate to **Deployment slots** in the function app, and then select the slot name.
226
226
227
-
:::image type="content" source="./media/functions-deployment-slots/functions-navigate-slots.png" alt-text="Find slots in the Azure portal." border="true":::
227
+
:::image type="content" source="./media/functions-deployment-slots/functions-navigate-slots.png" alt-text="Screenshot show the page where you find slots in the Azure portal." border="true":::
228
228
229
229
1. Select **Delete**.
230
230
231
231
:::image type="content" source="./media/functions-deployment-slots/functions-delete-deployment-slot.png" alt-text="Screenshot that shows the 'Overview' page with the 'Delete' action selected." border="true":::
232
232
233
233
1. Type the name of the deployment slot you want to delete, and then select **Delete**.
234
234
235
-
:::image type="content" source="./media/functions-deployment-slots/functions-delete-deployment-slot-details.png" alt-text="Delete the deployment slot in the Azure portal." border="true":::
235
+
:::image type="content" source="./media/functions-deployment-slots/functions-delete-deployment-slot-details.png" alt-text="Screenshot shows deleting the deployment slot in the Azure portal." border="true":::
@@ -259,13 +259,13 @@ Use the following steps to change a slot's App Service plan:
259
259
260
260
1. Navigate to **Deployment slots** in the function app, and then select the slot name.
261
261
262
-
:::image type="content" source="./media/functions-deployment-slots/functions-navigate-slots.png" alt-text="Find slots in the Azure portal." border="true":::
262
+
:::image type="content" source="./media/functions-deployment-slots/functions-navigate-slots.png" alt-text="Screenshot shows the slots in the Azure portal." border="true":::
263
263
264
264
1. Under **App Service plan**, select **Change App Service plan**.
265
265
266
266
1. Select the plan you want to upgrade to, or create a new plan.
267
267
268
-
:::image type="content" source="./media/functions-deployment-slots/azure-functions-deployment-slots-change-app-service-apply.png" alt-text="Change the App Service plan in the Azure portal." border="true":::
268
+
:::image type="content" source="./media/functions-deployment-slots/azure-functions-deployment-slots-change-app-service-apply.png" alt-text="Screenshot shows where to change the App Service plan in the Azure portal." border="true":::
0 commit comments