azure - 使用共享程序集部署 Azure Function

标签 azure azure-functions

我正在构建一个 Azure 函数,我使用一种预编译方法。在函数本身中,我们只有一个调用“Process.Run()”来启动预编译的私有(private) DLL。这些 dll 保存在 Web 应用程序根目录下的共享文件夹中。

据我们所知,一切都运行完美,但现在我们想通过 ARM 模板或 PowerShell 脚本 (ZIP) 进行部署。我们还使用 Visual Studio 预览功能模板。

我们希望部署的形式是

-- Host
---Shared (Deploy DLL's in this folder)
---HttpTriggerFunctionCSharep1
----(Deploy the needed files to this directory)

最佳答案

可以通过多种方式部署 Azure Function。 Here这是一篇关于它的很好的博文,我将在下面为您总结并添加第四点。

  1. GIT 集成
  2. KUDU Rest API
  3. MSdeploy.exe/WAWSDeploy.exe
  4. ARM 模板与 MSDeploy 结合使用。

我首选的方法是#4。您需要为此部署执行几个步骤。

  1. 创建包含 Azure Function App 代码的 ZIP。 ZIP 中的内容需要有 correct folder structure .
  2. 将此 ZIP 上传到 Azure 存储 blob 容器。
  3. 在您的 ARM 模板中部署一个空函数应用( This one 可以作为您的起点。)
  4. 将 MSDeploy ARM 资源添加到 Azure Function App,以将 ZIP 部署到 Function App。这是 MSDeploy 资源的示例:
{
    "name": "MSDeploy",
    "type": "extensions",
    "location": "[resourceGroup().location]",
    "apiVersion": "2015-08-01",
    "dependsOn": [
        "[concat('Microsoft.Web/sites/', variables('functionAppName'))]"
    ],
    "properties": {
        "packageUri": "[concat('https://',parameters('storageAccount'), '.blob.core.windows.net/', parameters('storageContainer'), '/', parameters('zipFile'))]",
        "dbType": "None",
        "connectionString": ""
    }
}

我还发现了这个示例实现,它也基于我上面描述的原则:https://github.com/ianalderman/AZF_Samples/tree/master/DeploymentExample .

关于azure - 使用共享程序集部署 Azure Function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42237506/

相关文章:

无法使用 PayAsYouGo 帐户创建 Azure Verizon CDN 配置文件

azure - Umbraco 在 azure 上缓慢

azure - 在 Azure 函数中使用字体

Azurite 未在 Visual Studio 2022 中自动启动

接口(interface)底层对象的C#流利验证

azure - 使用服务总线触发器在 Azure Functions 上进行本地测试时提供 UserProperties

asp.net-mvc - 如何获取 Azure 自动化客户端的证书

azure - 哪些 CosmosDb 操作会导致 Azure 函数触发?

authentication - AAD 注册了 Azure Functions + GraphAP Delegated + SharePoint Online?

Python 和 Snowflake 如何将 Azure AD 用户名和密码添加到 Snowflake 连接以便能够访问帐户并运行 ETL 脚本?