-
Notifications
You must be signed in to change notification settings - Fork 53
PowerShell 6 to 7 Migration Guide
Stefanus Hinardi edited this page Mar 30, 2021
·
6 revisions
As we are quickly approaching end of life for PowerShell 6, we encourage developers to upgrade their PowerShell 6 to PowerShell 7, in order to get full support for PowerShell.
For more information on PowerShell lifecycle timeline, please refer to this page.
Note that Azure Functions will maintain existing PowerShell 6 Functions Apps
- Open you Azure Functions App using VS Code
- Navigate to "local.setting.json"
- Add the property "FUNCTIONS_WORKER_RUNTIME_VERSION" and set the value to "~7". The local.setting.json file should look like:
{ "IsEncrypted": false, "Values": { "AzureWebJobsStorage": "", "FUNCTIONS_WORKER_RUNTIME": "powershell", "FUNCTIONS_WORKER_RUNTIME_VERSION" : "~7" } }
-
Login to Azure Portal
-
Navigate To Azure Functions Portal
-
On the left Panel, click on Configuration
-
Click on Function Runtime Settings blade, verify that the Azure function runtime is set to
~3
, if not, set it to~3
and click Save -
Click on General Settings blade, change the PowerShell Version Setting to 7.0. and click Save
- To check the verify that your function app is running on Azure function runtime v3, execute
$SubId = …
$ResourceGroupName = ...
$AppName = ...
Get-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/appsettings"
- If the app is not running on Azure Functions v3 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 = '~3' } -Force
- Once the Azure Function runtime is upgraded to v3. execute the command bellow to migrate PowerShell 6 to PowerShell 7:
Set-AzResource -ResourceId "/subscriptions/$SubId/resourceGroups/$ResourceGroupName/providers/Microsoft.Web/sites/$AppName/config/web" -UsePatchSemantics -Properties @{ powerShellVersion = '~7' } -Force
In your ARM template, please specify these settings:
"siteConfig": {
"appSettings": [
...
{
"name": "FUNCTIONS_EXTENSION_VERSION",
"value": "~3"
},
{
"name": "FUNCTION_WORKER_RUNTIME",
"value": "powershell"
},
...
],
...
"powerShellVersion": ~7,
...
}