Home > Net >  How to change LinuxFxVersion in Azure function app
How to change LinuxFxVersion in Azure function app

Time:09-21

i have azure function with LinuxFxVersion set to DOTNET:

"siteProperties": {
"metadata": null,
"properties": [
    {
        "name": "LinuxFxVersion",
        "value": "DOTNET|3.1"
    },
    {
        "name": "WindowsFxVersion",
        "value": null
    }
  ],
    "appSettings": null
},

I want to set it to Python:

"siteProperties": {
"metadata": null,
"properties": [
    {
        "name": "LinuxFxVersion",
        "value": "Python|3.9"
    },
    {
        "name": "WindowsFxVersion",
        "value": null
    }
  ],
    "appSettings": null
},

According to msdn source, I need to use Power shell to change it:

az functionapp config set --name <func_name> --resource-group <rg> --linux-fx-version 'Python|3.9'

but im getting error:

'3.9' is not recognized as an internal or external command,
operable program or batch file.

When im typing just 'Python' i get response:

Operation returned an invalid status 'Bad Request'

How to change linux fx version in Azure Function from .NET to Python?

CodePudding user response:

The way you can solve this error in Powershell is to wrap up the string containing the pipe character with quotes.

Here are multiple examples:

  • az functionapp config set --name <func_name> --resource-group <rg> --linux-fx-version '"Python|3.9"'
  • az functionapp config set --name <func_name> --resource-group <rg> --linux-fx-version 'Python"|"3.9'

If you are running the above command in bash use : instead of |

  • az functionapp config set --name <func_name> --resource-group <rg> --linux-fx-version "Python:3.9"

https://octopus.com/blog/powershell-pipe-escaping

https://github.com/Azure/azure-cli/issues/7874

  • Related