使用'az functionapp createpreviewapp'导致python错误

时间:2018-09-25 02:47:46

标签: azure-functions azure-cli

Azure Functions on Linux Preview页上,我尝试使用以下方法创建新的python预览应用程序:

az functionapp createpreviewapp -n MyApp -g MyResourceGroup -l "eastus" -s mystoragename --runtime python --is-linux

这会导致以下错误:

__init__() takes 1 positional argument but 3 were given
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.0.46/libexec/lib/python3.7/site-packages/knack/cli.py", line 197, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/local/Cellar/azure-cli/2.0.46/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 369, in execute
    six.reraise(*sys.exc_info())
  File "/usr/local/Cellar/azure-cli/2.0.46/libexec/lib/python3.7/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/Cellar/azure-cli/2.0.46/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 343, in execute
    result = cmd(params)
  File "/usr/local/Cellar/azure-cli/2.0.46/libexec/lib/python3.7/site-packages/azure/cli/core/commands/__init__.py", line 182, in __call__
    return self.handler(*args, **kwargs)
  File "/usr/local/Cellar/azure-cli/2.0.46/libexec/lib/python3.7/site-packages/azure/cli/core/__init__.py", line 437, in default_command_handler
    result = op(**command_args)
  File "/Users/mike.mahoney/.azure/cliextensions/functionapp/azext_functionapp/custom.py", line 82, in create_function
    site_config.app_settings.append(NameValuePair('FUNCTIONS_EXTENSION_VERSION', '~2'))
TypeError: __init__() takes 1 positional argument but 3 were given

我在Mac上,使用brew安装了最新的Azure CLI工具(2.0.46)。

1 个答案:

答案 0 :(得分:2)

functionapp预览扩展和az cli的最新更新存在问题。

我们使用最新的扩展名0.0.2

更新了此处(https://github.com/Azure/Azure-Functions/wiki/Azure-Functions-on-Linux-Preview#prerequisites)的说明。

您可以通过执行

来检查已安装的产品。
az extension list

您应该看到类似

[
  {
    "extensionType": "whl",
    "name": "functionapp",
    "version": "0.0.1"
  }
]

要更新它:

here下载0.0.2扩展轮

然后做

az extension remove -n functionapp
az extension add --source <path to the Azure CLI extension whl file saved locally>