ARM \ Logic App Deployment with VSTS

If you prefer repeatable processes, free from human error you will be deploying your code in an automated fashion. Over the past 4 months with varied success I have been working on automating an entire Azure stack with logic apps and Function apps, Dynamics CRM and, to make it more complicated, yes, you guessed it, SharePoint.

My gut feeling was automating SharePoint in a repeatable way would take most effort. I was mostly correct, but it was not the battle I thought it would be! The real battle was trying to make a logic app deploy to 8 environments.

My approach was standardised. Create the logic app using the Azure portal, extract the template and parameterise it, and…. lets’ go.

Step 1 — create the Logic App

Go to the Azure portal https://portal.azure.com and create the logic app.

For some basic background, the logic app has a connection to SharePoint online and calls a function app.

Logic App, with some typical blocks

I have my logic app and it has all the blocks and works on Dev perfectly. Time to make it work in CI / UAT, etc.

Step 2 — extract the template using Azure

Virtually every resource in Azure can be extracted into an ARM Template (Azure Resource Manager Template), allowing you to spin up an environment using the Json based template.

Once in the portal you will see the option.

Automation Script option on every azure resource

You will be able to download the automation script.

Step 3 — configure parameters

Open your favourite code editor (my personal is VS Code or Visual Studio) and examine the template you just downloaded. You will notice a number of parameters in the template, you have 2 options to make it flexible.

Option 1 — Use a corresponding parameters file

parameters per environment, works but you may bloat your git repository

Option 2 — Put the parameters into VSTS Release (I prefer this way, saves you creating multiple param files in your git repository)

Step 4 — deploy and grab that much earned beer.

For my deployments, I use VSTS. There is a great task Microsoft have added called ‘Azure Resource Manager Deployment’ allowing you to automate your deployments for multiple environments (I have done it for 9 environments, and I can confirm it works great once you parameterise your script).