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-versions.md
+46-3Lines changed: 46 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,15 +126,25 @@ A pre-upgrade validator is available to help identify potential issues when migr
126
126
127
127
1. In *Search for common problems or tools*, enter and select **Functions 4.x Pre-Upgrade Validator**
128
128
129
-
To migrate an app from 3.x to 4.x, set the `FUNCTIONS_EXTENSION_VERSION` application setting to `~4` with the following Azure CLI or Azure PowerShell commands:
129
+
Once you have validated that the app can be upgraded, you can begin the process of migration.
130
+
131
+
> [!NOTE]
132
+
> If you are using a slot to manage the migration, you will need to set the `WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS` application setting to "0" on _both_ slots. This allows the version changes you make to be included in the slot swap operation. You can then upgrade your staging (non-production) slot, and then you can perform the swap.
133
+
134
+
To migrate an app from 3.x to 4.x, you will:
135
+
136
+
- Set the `FUNCTIONS_EXTENSION_VERSION` application setting to `~4`
137
+
-**For Windows function apps only**, enable .NET 6.0 through the `netFrameworkVersion` setting
138
+
139
+
You can use the following Azure CLI or Azure PowerShell commands to perform this upgrade directly on a site without slots:
130
140
131
141
# [Azure CLI](#tab/azure-cli)
132
142
133
143
```azurecli
134
-
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~4 -n <APP_NAME> -g <RESOURCE_GROUP_NAME>
144
+
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~4 -g <RESOURCE_GROUP_NAME> -n <APP_NAME>
135
145
136
146
# For Windows function apps only, also enable .NET 6.0 that is needed by the runtime
137
-
az functionapp config set --net-framework-version v6.0 -n <APP_NAME> -g <RESOURCE_GROUP_NAME>
147
+
az functionapp config set --net-framework-version v6.0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME>
You can use the following Azure CLI commands to perform this upgrade using deployment slots:
162
+
163
+
First, update the production slot with `WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0`. If your app can tolerate a restart (which impacts availability), it is recommended that you update the setting directly on the production slot, possibly at a time of lower traffic. If you instead choose to swap this setting into place, you should immediately update the staging slot after the swap. A consequence of swapping when only staging has `WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0` is that it will remove the `FUNCTIONS_EXTENSION_VERSION` setting in staging, putting the slot into a bad state. Updating the staging slot with a version right after the swap enables you to roll your changes back if necessary. However, in such a situation, you should still be prepared to directly update settings on production to remove `WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0` before the swap back.
164
+
165
+
```azurecli
166
+
# Update production with WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS
167
+
az functionapp config appsettings set --settings WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME>
168
+
169
+
# OR
170
+
171
+
# Alternatively get production prepared with WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS via a swap
172
+
az functionapp config appsettings set --settings WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME>
173
+
# The swap actions should be accompanied with a version specification for the slot. You may see errors from staging during the time between these actions.
174
+
az functionapp deployment slot swap -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME> --target-slot production
175
+
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~3 -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME>
176
+
```
177
+
178
+
After the production slot has `WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0` configured, you can configure everything else in the staging slot and then swap:
179
+
180
+
```azurecli
181
+
# Get staging configured with WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS
182
+
az functionapp config appsettings set --settings WEBSITE_OVERRIDE_STICKY_EXTENSION_VERSIONS=0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME>
183
+
# Get staging configured with the new extension version
184
+
az functionapp config appsettings set --settings FUNCTIONS_EXTENSION_VERSION=~4 -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME>
185
+
# For Windows function apps only, also enable .NET 6.0 that is needed by the runtime
186
+
az functionapp config set --net-framework-version v6.0 -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME>
187
+
188
+
# Be sure to confirm that your staging environment is working as expected before swapping.
189
+
190
+
# Swap to migrate production to the new version
191
+
az functionapp deployment slot swap -g <RESOURCE_GROUP_NAME> -n <APP_NAME> --slot <SLOT_NAME> --target-slot production
192
+
```
193
+
151
194
### Breaking changes between 3.x and 4.x
152
195
153
196
The following are some changes to be aware of before upgrading a 3.x app to 4.x. For a full list, see Azure Functions GitHub issues labeled [*Breaking Change: Approved*](https://github.com/Azure/azure-functions/issues?q=is%3Aissue+label%3A%22Breaking+Change%3A+Approved%22+is%3A%22closed+OR+open%22). More changes are expected during the preview period. Subscribe to [App Service Announcements](https://github.com/Azure/app-service-announcements/issues) for updates.
0 commit comments