Skip to content

Latest commit

 

History

History
238 lines (178 loc) · 14.7 KB

update-language-versions.md

File metadata and controls

238 lines (178 loc) · 14.7 KB
title description ms.topic ms.custom ms.date zone_pivot_groups
Update language versions in Azure Functions
Learn how to update the version of the native language used by a function app in Azure Functions.
how-to
devx-track-extended-java, devx-track-azurecli, devx-track-js, devx-track-python
12/06/2023
programming-languages-set-functions

Update language stack versions in Azure Functions

The support for any given language stack in Azure Functions is limited to specific versions. As new versions become available, you might want to update your apps to take advantage of their features. Support in Functions may also end for older versions, typically aligned to the community end-of-support timelines. See the Language runtime support policy for details. To ensure your apps continue to receive support, you should follow the instructions outlined in this article to update them to the latest available versions.

The way that you update your function app depends on:

  • The language you use to author your functions; make sure to choose your programming language at the top of the article.
  • The operating system on which your app runs in Azure: Windows or Linux.
  • The hosting plan.

::: zone pivot="programming-language-csharp"
This article shows you how to update the .NET version of an app using the isolated worker model. Apps that run on the in-process model can't yet be updated to .NET 8 without switching to the isolated worker model. To migrate to the isolated worker model, see Migrate .NET apps from the in-process model to the isolated worker model. For information about .NET 8 plans, including future options for the in-process model, see the Azure Functions Roadmap Update post. ::: zone-end

Prepare to update

Before you update the stack configuration for your function app in Azure, you should complete these tasks:

1. Verify your functions locally

Make sure that you test and verify your function code locally on the new target version.

::: zone pivot="programming-language-csharp" Use these steps to update the project on your local computer:

  1. Ensure you have installed the target version of the .NET SDK.

  2. Update your references to the latest stable versions of: Microsoft.Azure.Functions.Worker and Microsoft.Azure.Functions.Worker.Sdk.

  3. Update your project's target framework to the new version. For C# projects, you must update the <TargetFramework> element in the .csproj file. See Target frameworks for specifics related to the chosen version.

  4. Make any updates to your project code that are required by the new .NET version. Check the version's release notes for specifics. You can also use the .NET Upgrade Assistant to help you update your code in response to changes across major versions.

After you've made those changes, rebuild your project and test it to confirm your app runs as expected. ::: zone-end

2. Move to the latest Functions runtime

Make sure your function app is running on the latest version of the Functions runtime (version 4.x). You can determine the runtime version either in the Azure portal or by using the Azure CLI.

Use these steps to determine your Functions runtime version:

  1. In the Azure portal, locate your function app and select Configuration on the left-hand side under Settings.

  2. Select the Function runtime settings tab and check the Runtime version value to see if your function app is running on version 4.x of the Functions runtime (~4).

    :::image type="content" source="media/update-language-versions/update-functions-version-portal.png" alt-text="Screenshot of how to view the Functions runtime version for your app in the Azure portal.":::

Use this az functionapp config appsettings list command to check your runtime version:

az functionapp config appsettings list --name "<FUNCTION_APP_NAME>" --resource-group "<RESOURCE_GROUP_NAME>"  

The FUNCTIONS_EXTENSION_VERSION setting sets the runtime version. A value of ~4 means that your function app is already running on the latest minor version of the latest major version (4.x).


If you need to first update your function app to version 4.x, see Migrate apps from Azure Functions version 1.x to version 4.x or  Migrate apps from Azure Functions version 3.x to version 4.x. You should follow the instructions in those articles rather than just changing the FUNCTIONS_EXTENSION_VERSION setting.

Publish app updates

If you updated your app to run correctly on the new version, publish the app updates before you update the stack configuration for your function app.

Tip

To simplify the update process, minimize downtime for your functions, and provide a potential for rollback, you should publish your updated app to a staging slot. For more information, see Azure Functions deployment slots.

When publishing your updated app to a staging slot, make sure to follow the slot-specific update instructions in the rest of this article. You later swap the updated staging slot into production.

Update the stack configuration

The way that you update the stack configuration depends on whether you're running on Windows or on Linux in Azure.

When using a staging slot, make sure to target your updates to the correct slot.

[!INCLUDE functions-update-language-version-portal]

Note

You can only use the Azure portal to update function apps on Linux hosted in a Premium plan or a Dedicated (App Service) plan. For apps on Linux hosted in a Consumption plan, you must instead use the Azure CLI.

[!INCLUDE functions-update-language-version-portal]

::: zone pivot="programming-language-python"

  1. In the Azure portal, locate your function app and select Configuration on the left-hand side. When using a staging slot, make sure to first select the specific slot.

  2. In the General settings tab, update Python version to the desired version.

    :::image type="content" source="media/update-language-versions/update-python-version-portal.png" alt-text="Screenshot of how to set the desired Python version for a function app in the Azure portal.":::

    [!NOTE]
    You can't change the Python version when running in a Consumption plan.

  3. Select Save and when notified about a restart select Continue. ::: zone-end

::: zone pivot="programming-language-python"
Python apps aren't supported on Windows. Select the Linux tab instead. ::: zone-end
::: zone pivot="programming-language-java,programming-language-powershell" First, use the az functionapp list-runtimes command to view the supported version values for your language. Then, run the az functionapp config set command to update the language version of your function app:
::: zone-end
::: zone pivot="programming-language-csharp" Run the az functionapp list-runtimes command to view the supported version values for .NET on the isolated worker model: ::: zone-end
::: zone pivot="programming-language-java"

az functionapp list-runtimes --os "windows" --query "[?runtime == 'java'].{Version:version}" --output table

az functionapp config set --java-version "<VERSION>" --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot "staging"  

::: zone-end
::: zone pivot="programming-language-csharp"

az functionapp list-runtimes --os "windows" --query "[?runtime == 'dotnet-isolated'].{Version:version}" --output table

Run the az functionapp config set command to update the .NET version of your function app:

az functionapp config set --net-framework-version "v<VERSION>.0" --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot "staging"  

::: zone-end
::: zone pivot="programming-language-javascript,programming-language-typescript" First, use the az functionapp list-runtimes command to view the supported version values for your language stack (Node.js). Then, run the az functionapp config set command to update the Node.js version of your function app:

az functionapp list-runtimes --os "windows" --query "[?runtime == 'node'].{Version:version}" --output table

az functionapp config appsettings set --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --settings "WEBSITE_NODE_DEFAULT_VERSION=~<VERSION>" --slot "staging"  

::: zone-end
::: zone pivot="programming-language-powershell"

az functionapp list-runtimes --os "windows" --query "[?runtime == 'powershell'].{Version:version}" --output table

az functionapp config set --powershell-version "<VERSION>" --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot "staging"  

::: zone-end
::: zone pivot="programming-language-csharp,programming-language-java,programming-language-javascript,programming-language-typescript,programming-language-powershell"
In this example, replace <APP_NAME> and <RESOURCE_GROUP> with the name of your function app and resource group, respectively. Also replace <VERSION> with the supported language version to which you're updating. If you aren't using a staging slot, remove the --slot parameter. ::: zone-end

::: zone pivot="programming-language-python"

Note

You can't change the Python version when running in a Consumption plan. ::: zone-end
::: zone pivot="programming-language-java,programming-language-python,programming-language-powershell" Run the az functionapp list-runtimes command to view the supported linuxFxVersion site setting for your language version: ::: zone-end
::: zone pivot="programming-language-csharp,programming-language-javascript,programming-language-typescript" Run the az functionapp list-runtimes command to view the supported linuxFxVersion site setting for your language stack version: ::: zone-end
::: zone pivot="programming-language-java"

az functionapp list-runtimes --os linux --query "[?runtime == 'python'].{Version:version, linuxFxVersion:linux_fx_version}" --output table

::: zone-end
::: zone pivot="programming-language-csharp"

az functionapp list-runtimes --os linux --query "[?runtime == 'dotnet-isolated'].{Version:version, linuxFxVersion:linux_fx_version}" --output table

::: zone-end
::: zone pivot="programming-language-javascript,programming-language-typescript"

az functionapp list-runtimes --os linux --query "[?runtime == 'node'].{Version:version, linuxFxVersion:linux_fx_version}" --output table

::: zone-end
::: zone pivot="programming-language-python"

az functionapp list-runtimes --os linux --query "[?runtime == 'python'].{Version:version, linuxFxVersion:linux_fx_version}" --output table

::: zone-end ::: zone pivot="programming-language-powershell"

az functionapp list-runtimes --os linux --query "[?runtime == 'powershell'].{Version:version, linuxFxVersion:linux_fx_version}" --output table

::: zone-end ::: zone pivot="programming-language-java,programming-language-python,programming-language-powershell"
Run the az functionapp config set command to update the site setting for the new language version of your function app: ::: zone-end ::: zone pivot="programming-language-csharp,programming-language-javascript,programming-language-typescript" Run the az functionapp config set command to update the site setting for the new stack version of your function app: ::: zone-end

az functionapp config set --linux-fx-version "<LANGUAGE|VERSION>" --name "<APP_NAME>" --resource-group "<RESOURCE_GROUP>" --slot "staging"  

In this example, replace <APP_NAME> and <RESOURCE_GROUP> with the name of your function app and resource group, respectively. Also replace <LANGUAGE|VERSION> with the linuxFxVersion for your update. If you aren't using a staging slot, remove the --slot parameter.


Your function app restarts after you update the version.

Swap slots

If you have been performing your code project deployment and updating settings in a staging slot, you finally need to swap the staging slot into production. For more information, see Swap slots.

Next steps

::: zone pivot="programming-language-java"

[!div class="nextstepaction"] Java developer guide ::: zone-end ::: zone pivot="programming-language-csharp"
[!div class="nextstepaction"] C# isolated worker process guide ::: zone-end ::: zone pivot="programming-language-javascript,programming-language-typescript"
[!div class="nextstepaction"] Node.js developer guide ::: zone-end ::: zone pivot="programming-language-python"
[!div class="nextstepaction"] Python developer guide ::: zone-end ::: zone pivot="programming-language-powershell"
[!div class="nextstepaction"] PowerShell developer guide ::: zone-end