But, when you add more and more LogicApps your JSON file will grow and you might be better off putting each LogicApp within its own JSON. Not to speak of the parameters running wild within your files…
This post will explain how to set this up, and what is needed in your VSTS builds to enable the deployment of all the linked apps.
When you add a LogicApp to your existing project, you can expect a settings screen like below:
The result is a new set of params and a new resource:
Splitting up the LogicApps
To split up the files, several steps need to be taken.
- Move the LogicApps from the main JSON to separate files
- Update the main JSON file to point to the new separated files, and add parametes to work with artifacts/SAS during deployment
- Update the parameters file to set names and other settings
1. Move the LogicApps
The first step of separating the files is to create a folder (although not necessary, highly recommended because of readability) within your solution, and move the separate LogicApps into those folders.
2. Update LogicApp.json and add parameters
To link these new JSON files, the LogicApp.json needs to be updated, like in the following gist. Three new parameters are added to the JSON. The first two are used to link in VSTS to the blob storage that will hold these templates.
3. Update LogicApp.parameters.json
Finally we have to edit the parameters file. The next gist show how the default setup is, when creating LogicApps within one single JSON:
The next example show how to create a new configurationparameter object to hold the settings for the separate files. We will refer to these in the LogicApps within the folder.
Setup VSTS build
To leverage these templates, some additional steps need to be taken in VSTS. For example the artifacts and SAS tokens should be passed in as parameters.
In the build step, the templates should be copied to blob storage. After all, the linked templates only work with full URLs so we must place these in storage. Note the output parameters to be used in the next steps when validating the template:
Make sure you publish the artifacts to a folder, so you can pick these up in the release step!
Finally the release should be setup. In the first step the files are copied to blob storage, and the output parameters are used to capture the sas tokens.
Secondly the actual deploy uses the parameters from the previous step and deploys the actual apps to Azure.
Setting up the pipeline with linked templates is not difficult, but will take more time to setup properly. When everything is in place, adding more templates is very easy and the separation of the various apps in separate json files will increase maintainability and readability. It will also help you share your templates with your peers.
Feel free to ask me anything on this subject; drop me an email or contact me on Twitter.