Azure Functions and Logic Apps: Differences and When to Use Them
Microsoft Azure offers native serverless computing features. Two of the most crucial to master are Azure Functions and Azure Logic Apps. Each of them help enable business logic that automates your Azure workflow, but they have key differences and in fact can be used together in a complementary manner to offer flexible, powerful control over your cloud resources.
Let’s take a closer look at how each of these serverless automation platforms work within Azure and some use cases for them.
Azure Functions execute code using your choice from a wide variety of common modern programming languages like C#, F#, Node.js, Java, and PHO. You pay only for the time your code runs or pay for an unlimited App Service plan based on reserved instances. Functions can integrate with your existing code libraries and Azure platforms, including triggering as part of an Azure Logic App.
Azure Logic Apps are configured within a web portal and can execute your logic without programming any code. This is more simple to administrate as you only need to manage the properties of these logic blocks in your workflow; but it is also less powerful as you can not get as customized or granular as with Functions. However many (over 200) connectors are plug-and-play so Logic Apps are hardly limited. You pay per action or trigger, plus storage.
Here is a chart describing some key differences between Logic Apps and Functions:
Azure Functions Azure Log Apps
Normally stateless, but Durable Functions provide state
About a dozen built-in binding types, write code for custom bindings
Large collection of connectors, Enterprise Integration Pack for B2B scenarios, build custom connectors
Azure Application Insights, Log Analytics via Application Insights connector
Azure portal, Log Analytics, Azure Monitor
REST API, Visual Studio
Azure portal, REST API, PowerShell, Visual Studio
Can run on Azure, on premise, on Azure Stack, or in containers
Only run in Azure
Can be developed on your local workstation
Requires Azure connectivity
On Premise Connectivity
Supports Hybrid Connections via TCP tunnel or by using a VNET or App Service Environment to access local resources
On-Premises Data Gateway installs a local agent that enables local functionality of Logic Apps
90 days per workflow
Use Cases for Azure Functions and Logic Apps
Because Functions are code-based, you can write, execute, and test them on your local workstation. Any debugging can take place without involving your production cloud environment or provisioning additional (potentially costly) test resources in the cloud. This is also more efficient for your developers.
As mentioned above, Functions also offer more flexibility due to their basis in powerful programming languages. They are also portable into and out of Azure. Some common scenarios for using Functions include:
- Timer-based triggers
- Azure service event processing
- SaaS event prcessing
- Serverless web app and mobile app architecture
- Real-time stream processing or bot messaging
Logic Apps are preferable when you don’t wish to leverage developer resources and instead use the GUI. They are better suited to integrations as many connectors are available out of the box. Therefore Logic Apps can reduce your time to market in an automation scenario. Some common uses for Logic Apps include:
- SaaS event processing
- Timer-based or content-based triggers and routing
- Data ingestion or transformation
- Business Processes
- Integration between Azure cloud services
Of course, mixing and matching between the two is likely to be the correct answer for large scale enterprise cloud environments. Indeed, nesting Functions within your apps might be the most efficient way for some workflows. It all comes down to experimentation and efficiency.