在Azure门户中通过VSCode进行多个Azure Functions的部署。

huangapple go评论68阅读模式
英文:

Multiple Azure Functions Deployment in Azure Portal through VSCODE

问题

我已经从工作区中构建了一个Python Azure函数,并在Azure门户上部署,一切都运行完美,没有任何问题。但是,当我尝试在同一工作区上创建另一个函数时,部署会导致通知:"Azure工作区部署子菜单以前已注册"。

步骤1:VSCODE中的文件夹结构(我的两个独立函数Func_HTTPtrigger_SAPlogs和Func_HTTP_trigger_SQL)

在Azure门户中通过VSCode进行多个Azure Functions的部署。

步骤2:当我尝试从单个工作区部署这两个函数时,需要很长时间,而且无法在Azure门户中部署。

在Azure门户中通过VSCode进行多个Azure Functions的部署。

我尝试创建另一个具有新Azure函数的工作区,但在部署后,它会覆盖先前在Azure函数中部署的现有函数,而不会创建新函数。

请问有人能告诉我如何通过VSCODE部署多个函数吗?在我看来,可能需要在.vscode中进行一些调整,但不知道需要进行哪些更改。

  • 供参考
    扩展JSON文件如下:
{
      "recommendations": [
        "ms-azuretools.vscode-azurefunctions",
        "ms-python.python"
      ]
}
  • 供参考
    启动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": []
		}
	]
}
英文:

I have built an python azure function from a workspace and deployed on the azure portal which worked perfectly without any issues. But When I tried to create an another function on the same workspace, Deployment is leading to notifications "The azure workspace deploy submenu was already previously registered"

Step 1: The folder structure in VSCODE (My two separate functions Func_HTTPtrigger_SAPlogs & Func_HTTP_trigger_SQL)

在Azure门户中通过VSCode进行多个Azure Functions的部署。

STEP 2: When I tried to deploy the two functions from my single workspace, Its taking ages & not deploying in azure portal

在Azure门户中通过VSCode进行多个Azure Functions的部署。

I did tried creating another workspace with new Azure function However after deployment, its overwriting the existing function which was deployed in azure function earlier without creating a new function.

Can someone please advice how can we deploy multiple functions through VSCODE? In my perspective may be something needs to be adjusted in .vscode but dont know what is the change needs to be adapt

  • For the reference
    Extension json file looks like below:
{
      "recommendations": [
        "ms-azuretools.vscode-azurefunctions",
        "ms-python.python"
      ]
    }
  • For the reference
    launch json file looks like below:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Python Functions",
            "type": "python",
            "request": "attach",
            "port": 9091,
            "preLaunchTask": "func: host start"
        }
    ]
}
  • For the reference
    settings file looks like below:
{
    "azureFunctions.deploySubpath": ".",
    "azureFunctions.scmDoBuildDuringDeployment": true,
    "azureFunctions.pythonVenv": ".venv",
    "azureFunctions.projectLanguage": "Python",
    "azureFunctions.projectRuntime": "~4",
    "debug.internalConsoleOptions": "neverOpen"
}
  • For the reference
    settings file looks like below:
{
	"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": []
		}
	]
}

答案1

得分: 0

我已经尝试部署了两个Python HTTP触发器函数,VS Code Azure Functions扩展没有故障,正在加载并成功运行。

在Azure门户中通过VSCode进行多个Azure Functions的部署。

门户:
在Azure门户中通过VSCode进行多个Azure Functions的部署。

Azure Functions扩展完成其最后一个操作的时间非常长,这导致其他扩展无法运行。

Azure Functions中没有关于上述错误的问题注册。

我认为这可能是由于大型代码库阻止了VS Code中加载其他扩展所导致的。

检查您在VS Code中的扩展的启动激活时间,并尝试优化它。如果问题仍然存在,请在Azure Functions VS Code扩展的官方论坛中提出问题,参考链接:https://github.com/microsoft/vscode-azurefunctions/issues

英文:

I have tried to deploy the 2 Python Http Trigger Functions, VS Code Azure-Functions extension has no glitch, it is loading and working successfully.

在Azure门户中通过VSCode进行多个Azure Functions的部署。

Portal:
在Azure门户中通过VSCode进行多个Azure Functions的部署。

> The extension Azure Functions took a very long time to complete its last operation and it has prevented other extensions from running.

There is no issue registered in the Azure Functions with the above error.

I believe, this might happen due to large code base that is preventing to load other extensions in VS Code.

Check the Startup Activation time of your extensions in VS Code and try to optimize it.
Still if the issue persists, open the Issue in the Official forum of Azure-Functions VS Code Extension on this reference.

huangapple
  • 本文由 发表于 2023年3月4日 00:31:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75629631.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定