What are Azure Logic Apps used for?
Azure Logic Apps are a great way to accomplish a variety of integration in the cloud, like sending emails on some trigger or updating other systems via an API. There are already a variety of connectors available in Azure Logic Apps and additional connectors are added on a regular basis.
Today we would like to talk about HTTP – HTTP integration via Logic App as the middleware using Visual Studio 2017. We will talk about how we integrated two completely different systems via Azure Logic Apps and Function Apps, Insightly (CRM) and Maconomy (ERP).
Installation of Azure Logic Apps
- Firstly, open Visual Studio. On the Tools menu, select Extensions and Updates.
- Expand the Online category so you can search online.
- Browse or search for Logic Apps until you find Azure Logic Apps Tools for Visual Studio.
- In order to download and install the extension, click Download.
- Finally, restart Visual Studio after installation.
How the Azure Logic Apps and Function Apps work
Creation of Azure Logic Apps & Function Apps
Firstly, we created an empty logic app. This was so that it would give us the endpoint that is required to be called from Insightly. Then we went into Insightly settings and created a web hook for the logic app endpoint, to be triggered by events, for example on Project Creation.
We then create a Function app that will manipulate the payloads coming from the API request invoked via the Insightly web hook trigger. This allows us to take those payloads and export the data to a totally different system, i.e. the Maconomy ERP.
The Logic App scaffolds the required HTTP calls and Function App calls in the required sequence. We also make use of the template deployment system in Azure. This is to be able to provide parameters required for the app in a separate JSON file.
After exporting the data to the Maconomy ERP, we can use the same mechanisms to respond with a success message to Insightly. We can also update project instances in Insightly with any reference data which keeps the 2 platforms in sync.
Error Handling of Azure Logic Apps
Using the built-in connector by Azure Logic Apps to send an email, we add some basic error handling to provide notifications in the case of any errors in the process.
The extremely developer friendly part of the Azure Logic Apps are the detailed logs of each trigger of the app and the list of input and outputs to every step in the application execution process. These can help identify issues with very little effort.
Deployment of the Azure Logic Apps & Function Apps
Firstly, in the Visual Studio project, we simply right click on the project. Then we select the Azure account, subscription and the resource group for the Function App.
Finally, the Logic App requires parameters to be set for deployment. These were provided in an accompanying JSON file. If any required parameters were missing from the file, Visual Studio would just prompt and ask for the missing parameters. With the file in place, again we simply right click and select ‘Deploy’ from the context menu on the project in the solution.
A brief note about where the expression ‘Azure Licks’ comes from.
For anyone wondering where the expression ‘Azure Licks’ origionated, it is a Greenfinch Technology expression. It was coined by Greenfinch software developers to show the similarities between ‘Lick music‘ and small repeatable, reusable bits and pieces of works on Azure stack.