Insights on building robust business process orchestrations using Power Automate, Logic Apps and Azure Functions

Photo by @martinadams / Unsplash.com

I often end up automating a lot of things in my life I find too repetitive, or too boring to do manually. This might not always be the smartest thing to do, as learning how to do something esoteric might require a few hours’ of useful time when the actual task would perhaps only take 2 minutes once a week. For me, it provides an excellent learning opportunity, and when I get something working it brings me tangible evidence I can still learn new technologies and frameworks.

One of the things I did for years as a consultant was I scripted things. Most of the time I ended up using PowerShell, Linux shell scripts, VBScripts (back in the day..), regular Windows batch files, and the usual C#-based utilities. It’s been at least 20 years since I last touched Perl, and for that, I am grateful. Scripting is a highly useful skill, as you can resolve a pesky little issue that would otherwise end up costing a lot for a customer, and all this with relatively small effort.

Thus, Power Automate (previously Microsoft Flow), Logic Apps, and Azure Functions are key to building future business processes and orchestrating more complex processes. In recent months, I’ve helped troubleshoot a few – slightly more complex – implementations and wanted to write about a few core insights I picked along the way.

Start with Power Automate

I generally recommend just getting started with Power Automate. You can rapidly build working business processes with the service. The trick is to understand when Power Automate isn’t optimal for your needs. If you’ve been in the business long enough you might recall SharePoint Designer (formerly: FrontPage) and how people ended up building very complex, declarative workflows only to end up in a situation they couldn’t back out from.

I’ll provide an example to make my point more clear. Usually, when you write code using a programming language – such as C#, C++, or Java – you’re used to the basic capabilities of a given language. Such as doing a complex For..Each loop, or recursion. With recent advancements in modern programming languages, you’ll usually find a relatively easy and approachable way to answer your needs.

Now, with more complex recursions and looping, Power Automate often becomes a horrible mess. You end up resorting to multiple For Each-loops, that require variables, that must be defined previously, and that then makes it overly challenging to understand and get working. It might also be my own limitation, as I try to approach these challenges with a traditional programmer’s view; and Power Automate obviously aims to abstract all the complexities with ready-made actions.

Upgrade to Logic Apps

I’ve seen many people stick with Power Automate, and not graduating to Logic Apps for fear of failure, or for fear of Azure’s complexity. Admittedly, Azure is a beast – with around 200 services, separate billing and cost management aspects than Microsoft 365, and a very developer-oriented catering of services, it takes some courage to hop to that side of technology.

With Logic Apps, you essentially get all the same features of Power Automate, with plenty of added benefits. These include proper version control, easier and tighter integrations with analytics and metrics, and a plain licensing model. In addition, Logic Apps is more malleable for continuously changing business requirements. This allows you to use the same visualization engine for building the processes but also keeps the option open for leveraging Visual Studio for more sophisticated builds. Combined with automated builds of Azure DevOps (or GitHub Actions), I feel Logic Apps is the proper enterprise-grade integration and process orchestration platform for all needs.

You can migrate your Power Automate solutions to Logic Apps easily.

Spice it up with Azure Functions

Even with Logic Apps (and/or Power Automate), one sometimes needs additional capabilities. Built-in connectors and the ability to do inline code help massively, but even then you sometimes need a custom API to do some heavy-lifting for you.

With Azure Functions, you get to choose from your preferred language and using Logic Apps to call your code with ease. By encapsulating specific tasks as Azure Functions you can rapidly build any type of business function orchestrations with Logic Apps.

In summary

Admittedly, if you identify as a citizen developer or a power user, it’s easy to get started with Power Automate. It might then be intimidating to move on to ‘more’ developery services such as Logic Apps and Azure Functions. Once you cross over, it also requires a deeper understanding of programming logic and security. I feel it’s worth the effort, if you consistently find yourself hacking around problems in your Power Automate solutions.