Microsoft has provided an action for developers to add inline code to Logic Apps. As a developer, I really want this feature, as there is always a need to write inline code. Now, the catch with using inline code is that, you would also need an Integration account. For companies already using integration account, this is really not an issue. But for others, they would have to shell out the money just for this feature. They would have to evaluate and check if it is really good value for money, as developers could add a consumption based azure function to execute the inline code.

Derek Li from Microsoft mentioned that Inline Code will be offered without having to configure Integration account in the future. However, not really sure, when this will be offered. So, until such time, we are now left out with using Azure functions.

Azure functions offer a cost effective way to run all your small code fragments. However, if you had the need to write a lot of different lines of code for each of your Logic Apps, then you would end up with having a huge library which is just executing small fragments of code.

So, I thought of creating an alternative to use within the projects that I am delivering at the moment. Below is my idea

  • Create a Node.js Express application : I created a simple web api which accepts the inline code as a text and execute the code as a run time function
'use strict';
var express = require('express');
var router = express.Router();'/', function (req, res) {

    var body = req.body;

    let dynamicFunction = new Function(body.command);


module.exports = router;

As you can see, the method retrieves the command field from the request body and uses the Function class to create a dynamic function from the text. The dynamic function is then executed and the results are sent back to the caller.

  • Add docker support: This step is completely optional. I containerized this application and pushed this to Azure Container Registry. Using the image from the ACR, I then created a Azure container instance using powershell. When you create a container instance using Azure portal, you can’t assign a DNS name to the container. However, if you use powershell, you can assign ta DNS name to be used later.
  • If you don’t want to take the docker route, you could simply publish the node.js application to a Azure app service.
  • Logic App custom connector: This step is optional as well. As you have created a Azure app service or a docker instance, you could use a HTTP connector to send the inline code. However, if you want a extra step of look and feel, then you can go for the Logic App custom connector. With the Microsoft offering, you get intellisense support. However, the Logic App custom connector doesn’t let you do that much of customization on your custom connectors. So, you would have to write the code and test it somewhere before you apply it to your Logic Apps. Otherwise, you will end up doing too much trial and error.

The below image shows the usage of the custom connector with the inline code.

I acknowledge that this is too much work. But, your Logic App will look lot clearer, as you wouldn’t have to switch between Logic Apps and Azure functions to understand the whole logic. So, until Microsoft offers the Inline code as a individual component, I am going to use my custom connector

I will publish the code to github. Not really sure, if anyone wants to use it though 🙂

Visits: 1076

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x