如何将 Visual Studio 代码中的代码部署到专用终结点和 VNet 中的 Azure Function App?

How to deploy code from Visual Studio Code to Azure Function App in private endpoint and VNet?

我有 Azure Function Premium (Python) 以及私有网络和 Vnet in azure。

我目前无法使用来自工作站的 Visual Studio 代码部署到 Azure。

11.09.57 func-App-2-171221: Starting deployment...
11.09.57 func-App-2-171221: Creating zip package...
11.09.57 func-App-2-171221: Zip package size: 10 kB
11.09.58: Error:  Error 403 - Forbidden
The web app you have attempted to reach has blocked your access.

从我的笔记本电脑到 Function 应用程序建立网络访问权限的最简单方法是什么? (链接和教程表示赞赏)

此示例展示了 Azure Functions 如何通过 private endpoint connection. The sample uses an Azure Functions Premium plan with regional VNet Integration 连接到其他 Azure 资源以与限制在虚拟网络中的 Azure 资源进行交互。

下面是部署 azure 函数代码的示例代码。

func azure functionapp publish [YOUR-FUNCTION-APP-NAME]

有关完整信息,请查看 Private end points 文档。

  1. 为您的 function app 创建一个 zip,其中必须包含所有文件。 例如,在 python 中,zip 文件应包含
  • host.json
  • local.settings.json
  • requirements.txt
  • 您的 api 文件夹
  • .python_packages
  1. 将此 zip 文件上传到您的函数应用程序正在使用的 storage account 容器。
  2. 为此 blob 创建一个 SAS 令牌。 (确保 blob 是 private
  3. 复制blob URL.
  4. 转到 Function app -> configuration 并添加新的 application settings.
    键是 WEBSITE_RUN_FROM_PACKAGE,值是 <blob SAS URL you copied>
  5. Saverestart 您的函数应用程序。