Deploying a Node JS App to Azure App Service using Azure Dev-ops (Part 1)

Creating an azure web app and configuring a build pipeline for a Node JS app in Azure DevOps portal.

Nabil Nalakath
May 27 · 4 min read
CI-CD for Node JS App using Azure Dev-Ops

In this two-part tutorial, I am going to discuss how to deploy a Node JS application to Azure web app with Azure dev-ops CI-CD in very simple terms so that even a developer without much DevOps experience can deploy code within minutes.

The instructions on this page are assuming that you are familiar with the Azure portal and azure devops dashboard. If you don’t know how to add a project in Azure Portal or Azure DevOps please go through the tutorial here.

Step 1. Create an Azure Web App Service.

The first step is to create an Azure web app service on the Azure portal with the below configuration.

Creating a new Web App Resource in the Azure portal with the above configurations.

Once the web app is deployed login to your Azure dev-ops portal. Add new a new project from the dashboard and goto pipelines. Now let’s start adding our pipeline tasks to pull node js project from git, build and deploy it.

Step 2: Create a Build Pipeline

Click on the build pipeline to add a new pipeline. Now connect your git repository for the Node JS app. Github has an inbuilt integration that will open up in a new tab once you choose it, thanks to Microsoft’s 7.5 billion deal, but if your code is on an external or private repo like Gitlab choose Other Git. Click on add connection and enter your repo’s HTTP URL, username, and token key or password.

Once you have connected the git repository, the next step is to assign tasks to the build job. Azure provides a set of templates for building almost all kinds of application. But here we will choose an empty job to learn about the tasks.

Select the start with an Empty job.

Next, in the Agent Pool, you can choose whether you want to run your build tasks on Windows or Linux machines. Here I am choosing VS1017 for a windows machine.

Agent Pool for build tasks

Now comes the most important part of this process. Add the following tasks to the agent by clicking on the plus button beside the Agent Job title and edit the fields as specified.

Tasks under build agent.
  • Use Node JS
    Enter the version of Node JS you wish to use.
    Use Node 10.15.3
  • Npm install
    Specify the npm install command to install node modules.
  • Archive ( Refer screenshot 2.6)
    This task will zip the application folder. Add this task and edit the following fields:-
    Root Folder- $(System.DefaultWorkingDirectory)
    Archive file to create- $(Build.ArtifactStagingDirectory)/node.zip
    Note -Make sure to check the replace existing archive checkbox
Screenshot 2.6
  • Publish artifact ( Screenshot 2.7)
    This task will push the zipped project folder to the Azure Pipelines /TFS.
    Path to publish — $(Build.ArtifactStagingDirectory)
Screenshot 2.7

Step 4: Triggers

This is where you define how frequently you want azure dev-ops to check you Gitlab ( or any external git) repository for changes. This is not a very good practice but unfortunately, this is the only way unless you know how to set up trigger builds via webhook ( will be posting an article on this in future).

Polling Interval for Git

That’ all in build pipelines. We will go through the steps to completed release pipeline in the second part here.

JavaScript in Plain English

Learn the web's most important programming language.

Nabil Nalakath

Written by

Sapiophile. I Speak Code, love literature, binge thrillers, enjoy bibliosmia, crave desserts and seek adventures.

JavaScript in Plain English

Learn the web's most important programming language.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade