Go local with Azure Logic Apps development

Microsoft’s low-code business process automation tools add container runtimes and a local development environment.

Go local with Azure Logic Apps development
4X-image / Getty Images

Low- and no-code development have become key for digital transformation, giving information workers the tools to build the apps they need. There’s a significant app gap, one that under-resourced development teams are increasingly unable to fill. So giving tools to end-users to write code makes a lot of sense, as it lets them scratch their itches, building process automations that allow them to concentrate on the more complex parts of their tasks.

Microsoft has been rolling out enhancements to its Power Platform process automation suite, with a focus on working with its line-of-business Dynamics 365 suite. But the Power Platform isn’t the only low-code environment in Microsoft’s developer toolbox; Azure also offers a process automation workflow tool in the shape of its serverless Logic Apps.

Business process automation in Azure

Although Logic Apps is often thought of as a no-code tool, it’s better understood as an alternative to the venerable BizTalk business automation tool. When you build a Logic App, you’re providing basic rules for linking more than one application with a network of components, providing the rules and structure needed for message routing.

With Logic Apps, events from one application can be processed and routed to another using connectors to translate them into the appropriate format for an API. The systems being connected don’t need to be event driven; the connectors handle translation from event to write to RPC call to, well, however the application interacts with the world—even down to remotely driving a green-screen user interface.

It’s very much a developer-focused tool, helping fill the other app gap: the space between applications that weren’t intended to be used together, but when connected fulfil vital business functions. Using a serverless process automation tool helps solve a lot of problems; you don’t need to provision hardware, and you can use it to build hybrid applications that bridge SaaS platforms and on-premises code.

At first sight Logic Apps looks very like Power Apps, with a similar graphical editor for process flows. A recent update added a new design tool that helps visualize more complex workflows, as the application being built using Logic Apps uses more and more features, building out workflow rules that could be hard to display. Microsoft will continue to build on the new Logic Apps layout engine, adding features that come with the new Logic Apps runtime.

Writing Logic Apps in code

You don’t need to use a graphical tool to build a Logic App; Microsoft provides a JSON-based declarative programming language for building flows between connectors, with a set of Visual Studio and Visual Studio Code tools. The underlying technology is Microsoft’s Workflow Definition Language (WDL), which gives you the tools to build a workflow that links two more connectors using declarative statements.

The WDL is defined with a schema, which needs to be linked at the start of the JSON workflow file. This defines the version being used so the appropriate workflow engine is called. Your file will then define actions, triggers, and outputs. Triggers are the inputs to a workflow, with as many as 10 supported in a WDL application. That’s an advantage over the graphical designer, which lets you have only one trigger per workflow.

Switching to code can help build much more complex rule sets, allowing you to mix multiple inputs or have flows that are driven by conditional operations; for example, only processing an event on input 1 if inputs 2 and 3 both have specific values. Similarly, you can drive as many as 10 different outputs, through as many as 250 actions. Other options include parameters that are used within a workflow; these need to be defined before runtime.

Although there are issues with the visual designer in Visual Studio Code, it can help you create initial connections and visualize the flow of your WDL applications. Think of it as a visual linter, a way to quickly show problems and indicate dead ends and loops in your code. Building rule sets this way is relatively easy, but complex flows are best visualized before you try them out. You can use static results to build mocks into a flow, either for testing or to manage specific input or error cases.

Working with WDL in Visual Studio Code

WDL is a declarative language so it has the option of including expressions that are evaluated at run time. This approach lets you use values from parameter arrays; for example, if you have an array that contains lists of products and prices as an array of key/value pairs, you can use price in a flow by referencing the product in an expression.

As WDL is the output of the visual design tool in either Visual Studio or in the Azure Portal, you can use it to create an initial scaffold for your application and then edit it in Visual Studio Code to go beyond the limits of the visual tool. As part of the same project you can now create your own custom connectors or extend existing ones, linking Logic Apps to your own applications or to partner APIs.

The Visual Studio Code Logic Apps extension installs from the Marketplace as part of the Azure extension group, and you can access it directly from the Azure menu in the Code sidebar. Once signed into Azure, you can attach a new Logic App to an Azure account, either as an individual app or as part of a larger project. You will need to either create a new resource group for your Logic App or add it to an existing one.

Once you’ve chosen a region and named your app, you’re presented with a blank logic app and the JSON skeleton for its code. Usefully you’re not limited to running Logic Apps in Azure, as the runtime is containerized and can be hosted in your own Kubernetes environments or used as a local development environment on Windows, macOS, and Linux. Creating a local development environment requires opening a new local project from the Visual Studio Code Logic Apps extension, connecting it to an Azure resource group, and creating a Logic App.

A welcome expansion

Microsoft’s expansion of its Logic Apps platform is welcome, as workflow and process automation are important integration tools that allow you to link applications with minimal code. Adding it to both Visual Studio and Visual Studio Code makes it easier to include in projects, mixing serverless Azure Functions, local container runtimes, and your own custom connectors to build complex rules-based workflows with minimal code.

As Logic Apps gains more functionality with new runtimes and new development tools, it’s going to become more of an alternative to BizTalk, especially for organizations that are taking a hybrid approach to cloud development and using containers to move workloads between cloud and on-premises.

With Kubernetes seeing an increased role at the edge of the network, it will be possible to build and deploy process automation as close as possible to information sources, using containers for both Logic Apps and Functions, as well as for your own connectors. Logic Apps’ ease of development will be a bonus and, like Power Automate, should go some way to reducing the app gap, if not filling it.

Copyright © 2020 IDG Communications, Inc.