首页 > 解决方案 > 无法在 azure 中创建 python 函数

问题描述

我无法在 python 中创建可用于在 PowerApps 上运行 python 脚本的 azure 函数。

我已经在命令提示符和创建应用程序的视觉工作室上尝试过它,但我无法部署它。

是否可以使用 Microsoft Flow 自动执行 Python 脚本? 我正在使用此链接创建 azure 函数

(.env) C:\Users\PAhire2\MyFunctionProj>az functionapp create --resource-group myResourceGroup --os-type Windows --consumption-plan-location westeurope --runtime python --name NewApp --storage-account 1234store
usage error: Currently supported runtimes (--runtime) in windows function apps are: dotnet, node, java, powershell.

这是我收到的错误消息

标签: azureazure-functions

解决方案


你得到这个错误是因为 python 函数只能在 Azure 上的 Linux 操作系统上创建,所以只需将你的 os-type 更改为 Linux,它就会成功。

az functionapp create --resource-group mygroup --os-type Linux --consumption-plan-location westeurope --runtime python --name pythonfunctiontest --storage-account mystorageaccount

我使用 Azure Cloud Shell 进行测试,它可以工作。希望这可以帮助你。您也可以参考教程:在 Azure 中创建函数应用

在此处输入图像描述


推荐阅读