When I deploy an infrastructure you can guarantee my pipeline will consist of these three tasks for each Azure resource I deploy.
Replace Tokens - Guillame Ruchon's
Azure Resource Group Deployment - Microsoft
ARM Outputs - Kees Scholaart
Tokensiation Task
Firstly I use the Tokensiation task to update parameter files from Azure DevOps variables, I have blogged about that previously (see links) so I will not go into that again...
Azure Resource Group Deployment
Secondly, the Microsoft provided Azure Resource Group Deployment is vital for deploying ARM Templates. It is straight forward to use and just does what it says on the tin. It allows for multiple actions (create resource group, delete resource group, start or stop VM's), you specify a template file and can optionally specify a parameter file and/or override parameters.
ARM Outputs
Finally the ARM Outputs extension. This extension is hugely popular, at the time of writing it had over 15,000 downloads. I have been using this since version 2, it was re-written in version 4 and ported to Node, since then it has been lightning quick and runs in about 3 seconds which is a vast improvement from the 60 seconds it used to take.
This extension reads any outputs from your ARM Template deployment and creates a variable from them in Azure DevOps. This means you can output say a resourceId from a template deployment, and then use that resourceId as an input for your next template deployment, this can either be done by running the tokensiation task after ARM outputs task, or using the variable value eg $(resourceId) as an override parameter on an Azure Resource Group Deployment task.
Typical Infrastructure Pipeline
With these three extensions, you can chain templates together to form a modular and dynamic infrastructure. You can use the outputs of previous steps as inputs to progressive tasks. This is useful in situations like a Keyvault, where the Vaultname might be needed to input secrets to a key vault (or extract), or update a web app's connection string with secrets.
If only there was a way that I could role those 3 steps into a single re-usable modular release task to speed up pipeline building....(P.S. There is, but more on that in a future blog.)
Micah Jardine