azure - 如何在Azure函数应用程序中更改LinuxFxVersion

标签 azure powershell azure-functions

我有 azure 函数,LinuxFxVersion 设置为 DOTNET:

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

我想将其设置为Python:

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

根据msdn source ,我需要使用Power shell来更改它:

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

但我收到错误:

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

当我输入'Python'时,我得到响应:

Operation returned an invalid status 'Bad Request'

如何将 Azure Function 中的 Linux fx 版本从 .NET 更改为 Python?

最佳答案

在 Powershell 中解决此错误的方法是用引号将包含管道字符的字符串括起来。

以下是多个示例:

  • 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'

如果您在 bash 中运行上述命令,请使用 : 而不是 |

  • 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

关于azure - 如何在Azure函数应用程序中更改LinuxFxVersion,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69254014/

相关文章:

Azure AD B2C 密码重置 - 跳过电子邮件验证

powershell - 通过REST生成Jira用户的结果为401-此资源需要WebSudo

node.js - 了解 Azure Function 中的 Mongoose 连接

azure - 如何配置 Azure Functions V3 以在本地运行时允许 50+MB 文件

azure - 在 azure 流分析中使用拆分

c# - 有没有办法知道当前网络角色包含多少个实例?

azure - 如何在 Azure 门户中的两个现有 VM 之间创建网络连接

powershell - 双下划线 ($_.value__) 是什么意思?

json - ConvertFrom-Json 将小写 e 转换为大写字母(有时)

c# - 访问 Azure 函数绑定(bind)中的 EventGridEvent.EventType