0
votes

I want to use logic apps for making the workflow. I'm aware that logic apps provide the HTTP Request (endpoint) as the trigger, which can be used in order to start the workflow of the logic app. But I want to perform some tasks such as CRUD operations with database for which azure functions are preferred.

I was thinking to call the logic apps from the azure functions to achieve my goal. Is that the correct approach?If yes, then how can I do so using node or python.

Or should I call the functions within the logic apps? If I am trying to do so, then it gives me some error (where n customization has been done) that file not found.

2
Calling a function from logic app shuld be easy, there is an existing connector. what is the error you're getting ?Thomas
@Thomas I am getting the following error when I'm calling the azure functions from logic apps using connectors. NotFound. System.IO.FileNotFoundException: Could not find file 'D:\home\site\wwwroot\azure-from-logic'. File name: 'D:\home\site\wwwroot\azure-from-logic' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at .. However, I was able to successfully call the logic apps from azure function in node. But, if above error can be resolved then it would be grateful.christo-pher18
but this error is a azure function error ? not a logic app function. Did you use the azure function connector for logic app ? or you can use the http trigger actionThomas
This is the error which I'm getting while using the azure function as the connector from the logic apps, at the time I create the azure function , which gives me some automatically generated code. May be I am missing something,christo-pher18

2 Answers

1
votes

For calling Azure Function from a Logic App it's pretty straightforward without any code, only you need to use Azure Function connector and for example You have a HTTP trigger logic app so you can connect it with Azure Function after the incoming request as part of your work flow as shown below:

enter image description here

For calling HTTP Trigger's Logic App from your Azure Function it will be also straightforward using any HTTP client based on your programming language and there is no best practice here related to Logic App calling like you asked in your question but you should follow the normal code standards while dealing with HTTP calls based on your programming language for example this is a C# example:

enter image description here

0
votes

Either calling azure logic apps from azure functions, or do the same reversely, as @Thomas said, you need to use a connector to integrate Azure Logic Apps with Azure Functions. And Azure Logic Apps offers it - a build-in connector for Azure Function.

There is a section introduces 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.

Call functions from logic app, you can use the same connector as the document introduced, or a HTTP connector can do the same if using HTTP trigger on Azure Functions normally, even other triggers of Azure Functions can be used to integrate with logic Apps using the related connectors.

Hope it helps.