Parameters in Logic Apps ARM templates

One of the things you have to do during your development for a Logic App is to parameterize your Logic App ARM template. Working with parameters in Logic Apps ARM templates will enable your integration to be able to move from one environment to another without you having to change the ARM template to accommodate password, addresses and many other configurations related to one specific environment.

So, in this post, I’ll show how you do to create ARM template parameters for Logic Apps, and how to use the data type as string, secureString, objects, and secureObjects. I’ll show also how to protect your credentials by using the Azure Key Vault during deployment time.

The Logic App

I’m going to use the Logic App that I created in the post that I showed how to implement pub/sub with Log Apps and Service Bus. The Logic App I’m using is called ServiceBusToPastelDoKyoto. This Logic App has a service bus trigger to capture messages from the messagebox topic using the subscription ToPastelDoKyoto. Please refer to the link above for more information about the Logic App itself.

Just for the sake of the completeness of things I want to show in this post, I’ll add an HTTP connector that requires basic authentication on top of the development that I did in that post.

I created a Visual Studio project of type Azure Resource Group and selected as template Logic App. The standard implementation of a Logic App in Visual Studio will give you an empty ARM Template for it as well one parameter file as the picture below shows this.

Parameters

As you can see in the code below, I need to provide connection details for Azure Service Bus and for Twilio connectors. Azure Service Bus needs the connection string and Twilio needs the SID and token information and a few other things.

Organizing the parameters

Even though the simple parameters above work fine, I like to see a more structured approach for defining the parameters that relate to each other. So, if I have several parameters for Twilio and a few more for Service Bus, I would like to group them in objects or secureObjects as you can see in the next two code sections. In the first code block the definition in the Logic App ARM template and then the parameter file in the second code block.

Secure Parameters

So far you have seen the application of parameters in ARM Templates and how to provide versions of them according to your environments. One thing to note though is that when setting credentials for connectors you don’t want to expose them to the developers, that’s when Azure Key Vault comes in the picture.

With Azure Key Vault, someone can create the secure values, and you just reference them in your Logic App ARM template. Below is the code of how you will reference the keys stored in Key Vault.

Follow me

I'm an Integration Specialist, Certified Azure, BizTalk, and Mulesoft working with integrations technologies like BizTalk, Logic App, Service Bus, Azure Functions, and Mulesoft.
Currently working as a Lead Integration Consultant for Theta in Auckland, New Zealand.
If you need an integration specialist for designing a solution, mentoring, training, or just someone to talk to understand better your options, contact me.