Skip to content

Upgrading your Azure Function Apps to run on PowerShell 7.2

MadhuraBharadwaj-MSFT edited this page Aug 19, 2022 · 6 revisions

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 Functions Runtime version is set to ~4.

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. 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",
    ...
}
Clone this wiki locally