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