通过VSCODE在Azure Portal中部署多个Azure功能

u3r8eeie  于 2023-03-09  发布在  Vscode
关注(0)|答案(1)|浏览(123)

我已经从工作区构建了一个python azure函数,并部署在azure门户上,该函数运行完美,没有任何问题。但当我尝试在同一工作区创建另一个函数时,部署会导致通知“azure工作区部署子菜单先前已注册”
步骤1:VSCODE中的文件夹结构(我的两个独立函数Func_HTTPtrigger_SAPlogs和Func_HTTP_trigger_SQL)

第2步:当我尝试从我的单一工作区部署这两个功能时,它花费了很长时间,并且没有部署到Azure门户中

我确实尝试过用新的Azure函数创建另一个工作区,但是在部署后,它覆盖了先前在Azure函数中部署的现有函数,而没有创建新函数。
有人能告诉我们如何通过VSCODE部署多个函数吗?在我看来,可能需要在.vscode中进行一些调整,但不知道需要适应哪些变化

  • 参考扩展json文件如下所示:
{
      "recommendations": [
        "ms-azuretools.vscode-azurefunctions",
        "ms-python.python"
      ]
    }
  • 参考launch json文件如下所示:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Python Functions",
            "type": "python",
            "request": "attach",
            "port": 9091,
            "preLaunchTask": "func: host start"
        }
    ]
}
  • 参考设置文件如下所示:
{
    "azureFunctions.deploySubpath": ".",
    "azureFunctions.scmDoBuildDuringDeployment": true,
    "azureFunctions.pythonVenv": ".venv",
    "azureFunctions.projectLanguage": "Python",
    "azureFunctions.projectRuntime": "~4",
    "debug.internalConsoleOptions": "neverOpen"
}
  • 参考设置文件如下所示:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "func",
            "label": "func: host start",
            "command": "host start",
            "problemMatcher": "$func-python-watch",
            "isBackground": true,
            "dependsOn": "pip install (functions)"
        },
        {
            "label": "pip install (functions)",
            "type": "shell",
            "osx": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "windows": {
                "command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
            },
            "linux": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "problemMatcher": []
        }
    ]
}
pvcm50d1

pvcm50d11#

我已经尝试部署2 Python Http触发器函数,VS代码Azure-Functions扩展没有故障,它正在加载并成功工作。

门户网站:

扩展Azure Functions花了很长时间才完成其最后一个操作,并且已阻止其他扩展运行。
Azure函数中没有注册具有上述错误的问题。
我相信,这可能是由于大量的代码库,这是防止加载其他扩展在VS代码发生。
检查VS代码中扩展的启动激活时间并尝试优化它。
如果问题仍然存在,请在此reference上的Azure-Functions VS Code Extension官方论坛中打开此问题。

相关问题