Deploy a Node.js App to a Deployment Slot in Azure DevOps

1.5 hours
  • 3 Learning Objectives

About this Hands-on Lab

You have been given the code for a Node.js application and must deploy it to an Azure WebApp with two slots. Use Azure DevOps to integrate the code and deploy it to the `dev` slot in the Azure WebApp provisioned with this hands-on lab.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create an Azure DevOps Organization
  • Log in to the Azure Portal using the provided credentials
  • Search for Azure DevOps from the services menu
  • Create a new organization and project named MyFirstProject
Push code to Azure Repos and Create a Build
  • Log in to the Linux VM provided with this lab
  • Use the following command to clone the node-express branch of the repository:
    • git clone -b node-express https://github.com/linuxacademy/content-az400-lab-resources.git
  • Remove the GitHub origin with the following command
    • git remote remove origin
  • Copy the commands from Azure Repos to add the new remote origin and push the code
  • Start a new build pipeline using the YAML present in the new Azure DevOps repo
Deploy Node.js App to Azure WebApp Slot
  • Create a release pipeline from Azure DevOps
  • Select the source as the existing packaged artifact
  • Within the Stage, add the task to deploy to Azure WebApp
  • Add a task to swap slots from dev to production

Additional Resources

Start by logging into the Azure portal and creating a new Azure DevOps Organization. Connect to the Linux VM provisioned with this lab and clone the node-express branch of the following repository: [git clone -b node-express https://github.com/linuxacademy/content-az400-lab-resources.git](git clone -b node-express https://github.com/linuxacademy/content-az400-lab-resources.git)

Once you have the code, push to your new Azure Repos repository. This repository contains the build YAML, so you can kick off a build pipeline easily. Once you have the build artifact, start a release pipeline and add the appropriate tasks to deploy the artifact to Azure App Services (to the dev slot) and swap slots with production.

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?