从 Azure 函数调用逻辑应用程序

calling logic apps from azure functions

我想使用逻辑应用来制作工作流。我知道逻辑应用程序提供 HTTP 请求(终结点)作为触发器,可用于启动逻辑应用程序的工作流。但是我想执行一些任务,例如对首选 azure 函数的数据库进行 CRUD 操作。

我想从 azure 函数 调用逻辑应用程序来实现我的目标。这是正确的方法吗?如果是,那么我该如何使用 node 或 python.

或者我应该调用逻辑应用程序中的函数吗?如果我尝试这样做,那么它会给我一些找不到文件的错误(已完成 n 自定义)。

要么从 azure functions 调用 azure logic 应用程序,要么反过来,正如@Thomas 所说,您需要使用连接器将 Azure Logic Apps 与 Azure Functions 集成。 Azure Logic Apps 提供它 - a build-in connector for Azure Function.

有一节介绍Call logic apps from functions, as below, and the interal link show more details. Even there is a sample scenario Trigger logic apps with Azure Functions and Azure Service Bus

When you want to trigger a logic app from inside an Azure function, the logic app must start with a trigger that provides a callable endpoint. For example, you can start the logic app with the HTTP, Request, Azure Queues, or Event Grid trigger. Inside your function, send an HTTP POST request to the trigger's URL, and include the payload you want that logic app to process. For more information, see Call, trigger, or nest logic apps.

从逻辑应用程序调用函数,可以使用文档介绍的相同连接器,或者在Azure Functions上正常使用HTTP triggerHTTP连接器也可以,甚至Azure Functions的其他触发器也可以用于使用相关连接器与逻辑应用程序集成。

希望对您有所帮助。

从逻辑应用程序调用 Azure 函数非常简单,无需任何代码,只需要使用 Azure 函数连接器,例如您有一个 HTTP 触发器逻辑应用程序,因此您可以在传入请求后将其与 Azure 函数连接作为您工作流程的一部分,如下所示:

对于从您的 Azure 函数调用 HTTP 触发器的逻辑应用程序,使用基于您的编程语言的任何 HTTP 客户端也很简单,这里没有与您在问题中所问的逻辑应用程序调用相关的最佳实践,但您应该在处理基于您的编程语言的 HTTP 调用时遵循正常的代码标准,例如这是一个 C# 示例: