Deploying resources to Azure using Azure DevOps

Recently someone asked me how to deploy an Azure service using Azure DevOps. In this Blog Post a simple howto how to deploy a virtual machine on Azure using DevOps.

Step 1 Create an ARM template

For this first step create an IaaS VM with all the settings you need. Notice in the final step the following options :


Choose to download the template for automation.


Choose Download. You now a file with two files (parameters and template). Rename the two files to identify them in the future.

Step 2 Upload the template to the Azure DevOps repository

Go to your DevOps project|Files. In my demo enviroment I’ve created a tree with all my templates.


As you can see i’ve renamed the 2 files to demo_vm_parameters and demo_vm_template.


After uploading the template, now let’s create a release pipeline!

Step 3 Create a release Pipeline

Go to Pipeline|Releases


We are going to create a New release pipeline :


Choose to start with an Empty job (we are going to fill it in manually)


Give your stage name a name that makes sence 🙂


Now choose to add an artificat (the location where your templates are located)


Choose the repository you’re using. In my case I’m using an Azure Repo.


Select add. Now choose the link with 0 task and add an agent:


We are going to deploy an ARM template, so therefore choose the ARM template deployment agent.


After you press add, we can configure this agent with all the necessary parameters. Notice the Template and Template parameters. Here you select the 2 files you’ve just uploaded.


Ok! Release pipeline created. Check!


Step 4 Create an release


Choose the Create release option and see that your first release (Release-1) has been created:


Click the Release-1 link to see the status of your deployment..

Oh oh…. Failed doesn’t seem to look to good….


I think we must read the next chapter quickly 🙂

Step 5 Troubleshooting

Click the Failed link to see the error. As you can see, it has something to do with the adminPassword beeing null. That’s correct. For demonstration purposes I’ve intensely uploaded the out-of-the-box template file. For security purposes the Azure portal doesn’t include the admin password when exporting it to an ARM template file. Let’s fix this!


Go tho your Repository and edit the parameters file:


Change the null to “somethingElseP2Swword” or any other password. Now commit this file.


Now let’s try again. Create another release of the Pipeline you’ve just created and click the link immediatly to follow the progress :


Et voila! The Stage was succeeded! Congrats! Job well done!


As you can see all the steps are completed succesfully:


And when you logon to the Azure Portal, you see your demovm IaaS VM running!


1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.