Linting Your ARM Templates with Azure Pipelines

1 hour
  • 3 Learning Objectives

About this Hands-on Lab

You have been given an Azure Resource Manager (ARM) template that may or may not contain JSON errors. You need to ensure that the code is clean in order to proceed with deployment. You can achieve this by using Azure Pipelines and adding linting to your pipeline.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create an Azure DevOps Organization
  1. Login to the Azure portal using the provided credentials.
  2. Search for "Azure DevOps" from the All services page.
  3. Create a new organization and project named MyFirstProject.
Push Code to Azure Repos
  1. Log in to the Linux VM provided with this lab.

  2. Use the following command to clone the arm branch of the repository:

    git clone -b arm https://github.com/linuxacademy/content-az400-lab-resources.git
  3. Remove the GitHub origin with the following command:

    git remote remove origin
  4. Copy the commands from Azure Repos to add the new remote origin and push the code.

Create the Pipeline
  1. Create a new Azure build pipeline in the classic editor.
  2. Add the appropriate tasks to install JSONLint on your build agent.
  3. Run JSONLint and specify the template.json file.

Additional Resources

  1. Log in to the Azure portal.

  2. Search "Azure DevOps" from the All services page to create a new Azure DevOps organization.

  3. Proceed to create a new project.

  4. From the Linux VM provided with this hands-on lab, use the following command to clone the arm branch of this GitHub repo:

    git clone -b arm https://github.com/linuxacademy/content-az400-lab-resources.git
  5. Remove the GitHub remote origin.

  6. Add the newly created Azure Repos origin and push the code.

  7. Once the code resides in your new Azure Repos repository, create a new pipeline and add the appropriate tasks in order to lint the arm template using jsonlint.

  8. Run the pipeline and detect if any errors exist.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?