Using Parameters in Azure Logic Apps Standard (VS Code)
In a previous tip, we discussed how we can use parameters in Azure Logic Apps (Standard) using the Azure Portal as our development tool. In this post, we are going to create and use parameters but using VS Code.
The benefit of using parameters is that it makes our code more portable and allows us to move our Logic Apps across different environments (dev/test/production).
Our scenario will be the same as the other post where we will parameterize an email address that we can configure from outside of our core logic app configuration.
As a starting point, I have created my logic app (Standard) in VS Code using hard coded values. I have saved it and deployed it to Azure to ensure everything works as expected.
We can now create our parameter by clicking on the [@] Parameters link and then the Create parameter link. Subsequently, we will be asked to provide a parameter Name, Type and Value.
Once we save our workflow, we will discover a parameters.json file has been created within our project. If we open it up, we can see our emailAddress parameter has been created. If we want, we can manually add more parameters as long as we conform to the appropriate structure.
With our parameter created, we can now go and add it to our workflow configuration by updating our Office 365 Outlook action.
We can now deploy our logic app and when we do, we will discover that our parameter has been uploaded to our logic app service.
It is important to only update parameters from one place. For example, if you add parameters in the Azure Portal and then deploy from VS Code (or source control), that deployment will overwrite the values in the Azure Portal. It doesn’t update them; it will remove and create new.
We can now go ahead and run our logic app. When we do, we will see our parameter being injected at runtime.
Whether you create your parameters in the Azure Portal or from VS Code, you can make your configuration more portable and avoid “development in production” when you deploy your workflows.