What if we combine the powers of Logic Apps and AzFunctions !? 😍❤✔
Tags: serverless, azure, productivity
Published: 2019-09-28 09:02:05

Azure Logic apps are awesome to build serverless workflows. Having a bunch of pre-built connectors to different systems and services, it is often easy to hack a workflow, model a PoC etc.. The visual representation helps the business to understand the implementation detail. When things fail, it is easy to know in which step did the run fail and most often it is also easy to understand the reason of failure. So the point is, I love Logic apps for their simplicity... 

Now What I don't find easier in this model is that, 

1. Parameterizing Logic Apps for CI/CD pipeline is a nightmare. Atleast, to me 🤦‍♀️

2. The connectors have operational limits. When you design your solution you have to be thoroughly aware about the throttling limits of various steps inside your workflow 🚴‍♂️

3. When the number of steps in the workflow increases, the visual complexity / viewing experience becomes too noisy. Think about nested foreach loops and switch cases branching off to additional workflows 🧐

4. And when things go wrong inside deep nested workflows, things get harder to debug 🤨😏😣 Imagine you have a foreach loop in the logic app that ran 205 times and you are interested in one particular loop (say that was the 179th loop, but you don't know that unless you know it). Good luck clicking through the next button of the loop step 

![Logic App](https://thepracticaldev.s3.amazonaws.com/i/u7nc4izgkauhvjyh53n0.PNG)


Again there are better methods and practices to get around these problems. It just isn't simple. After all a tool is only as good as the one who is using it. But the question is, can it be any better ? Like in every other case it definitely can. In this story I would like to share what I think could be an awesome product feature on the top of AzureFunction that could address this situation

Azure function helps developers focus on their code doing the thing. Now the idea is to be able to add visual representation to the methods of the code which executes a particular workflow by decorating the method. 

The visual representation could look to the likes of the logic app showing off the input params / output params + Trace steps to start with. By the way it is already possible to achieve something similar through #ApplicationInsights but the viewing experience is more fluid, the way logic app represents the runs.

Normally Azure Function Runs will be represented like this 

![Az Function](https://thepracticaldev.s3.amazonaws.com/i/zn8n0j0sd2llbs6haelh.PNG)

Clicking on one of these Runs would lead you to the Invocation Details, that is the logs traced for that function run and clicking one level further would execute a kusto query drilling down to all traces,dependencies,exception and other props from ApplicationInsights tables tracked for the operation Id of that function run

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/q9xxcht8yk1j72kvhk1o.PNG)


it would be nice if clicking on the function run would first reveal the visual representation of the function just like the logic app .. but this time it is up to the developer to abstract the complexities of the function or NOT in order to represent the clear workflow of the function.

This model could be more inclusive bringing the business closer to the dev & ops functions.. Well that's what i think 😊😎 

So it gives the power of easy dev ( code, debug, CI/CD ) + the benefits of the visuals of Logic App and could be a new tool in the box to get the job done 😀 What do you think ?