The Dynamic Duo of Azure Functions & Logic Apps
by Wely Lau
The word “serverless” has been a big trend in the past two years. With key benefits such as accelerated development time, automatic infrastructure scaling, and sub-second billings, it sounds like a sweet deal for developers. In fact, Mark Russinovich (CTO of Azure) mentioned the word “serverless nirvana” during his interview with GeekWire, whereby he stated that serverless will be the big trend in near future. The fact that all major cloud platforms offer serverless technologies proves this is a valid assertion.
In this blog post, we will discuss Azure Function and Logic Apps, the so-called dynamic duo that provides a solid serverless platform in Azure.
The following figure shows a C#-based http-trigger functions code in Azure Portal.
We have published a book named Practical Azure Functions, where you can learn more about the practical aspect of what can you do with Azure Functions.
Azure Logic Apps
Unlike Azure Functions, which is a code-based offering, Logic Apps is a workflow-based serverless offering. This means that you won’t write code on Logic Apps, but instead make use of the workflow designer to author the logic. Logic Apps features hundreds of connectors which enable developers to build integrated cloud systems effectively. The following diagram shows some of the connectors which you can leverage when building solutions with Logic Apps.
Like Azure Functions, Logic Apps also starts by a trigger that you can define in the Logic App designer. On top of the built-in trigger, such as http and timer trigger, you have a lot more varieties of triggers from the connectors. For example, you can define a trigger when an email arrives in an Outlook mailbox, when a new post has been added on a Facebook page, when a new lead has been entered in a CRM, etc.
The following diagram shows you how to author a workflow with the Logic App designer.
You may learn more about Azure Logic Apps here.
Azure Functions and Logic Apps: Better Together
A common question is, “Should we use Functions or Logic Apps?” It pretty much depends on the app that you are building. If you are expecting an environment where you can write code, then Azure Functions would be the obvious choice. If you’d like to develop a solution without having to write code, or to only write very minimal code, then Logic Apps would be the more appropriate choice.
As a matter of fact, you can combine the two together and they work very well. A common scenario that people perform is to make use of Logic Apps as the core workflow orchestrator, and then invoke Azure Functions to run the code. This is typically due to the fact that you can develop a workflow-based application very quickly with Logic Apps.
The above diagram shows how you could execute Azure Functions from Logic Apps designer.
We started this article by discussing the trend of serverless computing in the industry. We subsequently learned about Azure Functions (the code-based serverless offering) and then Logic Apps (the workflow-based serverless offering.) Finally, we discussed the possibility of using both of them together for a powerful serverless offering.
About the Author
Wely Lau is a developer, architect, trainer, consultant, technical writer, and technology lover. With the grant of ASEAN Graduate Scholarship, Wely obtained his Master of Science in Information Systems from Nanyang Technological University. He currently works as Cloud Solution Architect on Azure Application Development Platform for Microsoft Asia Pacific. In his spare time, he writes blogs, delivers presentations , and participates in online communities. His passion in driving Microsoft technologies, especially in Azure, awarded him the first Azure MVP in Southeast Asia.
This article was contributed by Wely Lau, author of Practical Azure Functions.