Skip to content

Upgrading your Azure Function Apps to run on PowerShell 7.2

Madhura Bharadwaj edited this page Jan 26, 2023 · 6 revisions

Note: Support for PowerShell 7.0 in Azure Functions has ended on 3 December 2022. While your existing PowerShell Function Apps running on 7.0 will continue to run, we'll no longer provide updates or customer service for PowerShell 7.0. To ensure that your Functions apps are fully supported, you'll need to upgrade them to PowerShell 7.2. Learn more about PowerShell End-of-support dates.

Follow this guide to upgrade your existing Azure PowerShell Function Apps to PowerShell 7.2.

To run your Function App on PowerShell 7.2, ensure the value of FUNCTIONS_EXTENSION_VERSION is set to ~4.

In PowerShell Functions, the value "~7" for FUNCTIONS_WORKER_RUNTIME_VERSION refers to "7.0.x". We do not automatically upgrade PowerShell Function apps that have "~7" to "7.2". Going forward we will require that apps specify both the major and minor version they want to target. Hence, it is necessary to mention "7.2" if you want to target "7.2.x"

Developing PowerShell 7.2 function apps locally using VS Code

  1. Open your Azure Functions App using VS Code
  2. Navigate to "local.setting.json"
  3. Add the property "FUNCTIONS_WORKER_RUNTIME_VERSION" and set the value to "7.2".

The local.settings.json file should look like:

{ 
 "IsEncrypted": false, 
 "Values": { 
   "AzureWebJobsStorage": "", 
   "FUNCTIONS_WORKER_RUNTIME": "powershell", 
   "FUNCTIONS_WORKER_RUNTIME_VERSION" : "7.2" 
 } 
} 

Upgrading your Function App to run on PowerShell 7.2

Using Azure Portal

Note: Upgrading the language version of Linux Function Apps is currently not supported via the portal experience. For Linux, follow the instructions below for PowerShell/ARM

  1. Login to Azure Portal
  2. Navigate To Azure Functions Portal
  3. On the left Panel, click on Configuration under Settings
  4. Click on Function Runtime Settings blade, verify that the Runtime version is set to ~4. If not, set it to ~4 and click Save

Functions Runtime Settings


  1. Click on General settings blade, change the PowerShell Version Setting to 7.2. Click Save PowerShell Version

Using Azure PowerShell

For Windows

  1. To verify that your function app is running on Azure Functions Runtime v4, execute the following commands
$SubId = … 
$ResourceGroupName = ... 
$AppName = ... 

Get-AzFunctionAppSetting  -Name $AppName -ResourceGroupName $ResourceGroupName -SubscriptionId $SubId  
  1. If the value of the AppSetting FUNCTIONS_EXTENSION_VERSION is not set to ~4, that means you are not running on the latest Azure Functions v4 runtime. Execute the following command to upgrade:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/appsettings" -UsePatchSemantics -Properties @{  FUNCTIONS_EXTENSION_VERSION  = '~4' } -Force 
  1. When running on Windows, you also need to enable .NET 6.0, which is required by version 4.x of the runtime.
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ "NetFrameworkVersion"  = 'v6.0' } -Force
  1. Once the Azure Function runtime is upgraded to v4, execute the command below to migrate to PowerShell 7.2:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ powerShellVersion = '7.2' } -Force 

For Linux

  1. Since Linux support for Azure Function PowerShell Apps was not available prior to Functions Runtime v4, your App should already be on Functions Runtime v4. To upgrade your Linux PowerShell Function App to 7.2, execute the command below:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ linuxFxVersion = 'PowerShell|7.2' } -Force

Creating Azure Functions using PowerShell 7.2 in ARM template

For Windows

In your ARM template, please specify these settings:

        "siteConfig": { 
            "appSettings": [ 
                ... 
                { 
                    "name": "FUNCTIONS_EXTENSION_VERSION", 
                    "value": "~4" 
                }, 
                { 
                    "name": "FUNCTION_WORKER_RUNTIME", 
                    "value": "powershell" 
                }, 
                ... 
            ], 
            ... 
            "powerShellVersion": "7.2", 
            ... 
        } 

For Linux

"siteConfig": {
    "appSettings": [
        ...
        {
            "name": "FUNCTIONS_EXTENSION_VERSION",
            "value": "~4"
        },
        {
            "name": "FUNCTION_WORKER_RUNTIME",
            "value": "powershell"
        },
        ...
    ],
    ...
    "linuxFxVersion": "PowerShell|7.2",
    ...
}