Deploy Node.js applications to Azure App Service

Gopinath C H[MSFT]

This blog post shows how you can deploy a new Node.js application from Visual Studio Team Services or Microsoft Team Foundation Server to Azure App Service.



  1. Open your team project in your web browser (If you don’t see your team project listed on the home page, select Browse.)
  • On-premises TFS: http://{your_server}:8080/tfs/DefaultCollection/{your_team_project}
  • Visual Studio Team Services: https://{your_account}{your_team_project}
  1. Create a build definition (Build & Release tab > Builds)





  • Click Empty to start with an empty definition.
  • In the repository tab of build definition make sure the repository selected is the one where you pushed (Git) or checked in (TFVC) your code

Add the build steps

On the Tasks or Build tab, add these steps.

npmPackage: npm install Install your npm package dependencies.

  • Command: install
  • Set the working folder to the folder where your application code is committed in the repository

For example, in case of sample app it will be nodejs-express-hello-world-app

gulpBuild: Gulp Pack your files into a .zip file.

  • Gulp File Path: gulpfile.js
  • Advanced, Arguments: –packageName=$(Build.BuildId).zip –packagePath=$(Build.ArtifactStagingDirectory)
  • Set the Gulp file path. For example, in case of sample app it will be nodejs-express-hello-world-app/gulpfile.js
publishbuildBuild: Publish Build Artifacts Publish the build outputs, such as the .zip file as we do in the example below.

  • Copy Root: $(Build.ArtifactStagingDirectory)
  • Contents: $(Build.BuildId).zip
  • Artifact name: drop
  • Artifact Type: Server

Enable continuous integration (CI)

On the Triggers tab, enable Continuous integration (CI). This tells the system to queue a build whenever someone on your team commits or checks in new code.

Save, queue, and test the build

Save and queue the build. Once the build is done, click the link to the completed build (for example, Build 1634), click Artifacts, and then click Explore to see the .zip file produced by the build. This is the web deploy package that your release definition will consume to deploy your app.


  1. Open the Releases tab of the Build & Release hub, open the + drop-down in the list of release definitions, and choose Create release definition
  2. In the DEPLOYMENT TEMPLATES dialog, select the Azure App Service Deployment template and choose OK.


  1. Select the build definition you created earlier as the source of artifact to be deployed.


  1. Configure the Azure App Service Deployment task:
    Deploy: Azure App Service Deploy
    • Azure Subscription: Select a connection from the list under Available Azure Service Connections. If no connections appear, choose Manage, select New Service Endpoint | Azure Resource Manager, and follow the prompts. Then return to your release definition, refresh the Azure Subscription list, and select the connection you just created. Note: If your Azure subscription is defined in an Azure Government Cloud, ensure your deployment process meets the relevant compliance requirements. For more details, see Azure Government Cloud deployments.
    • App Service Name: the name of the App Service (the part of the URL without
    • Deploy to Slot: make sure this is cleared (the default)
    • Virtual Application : leave blank
    • Package or Folder: $(System.DefaultWorkingDirectory)***.zip (the default)
    • Advanced:
      • Take App Offline: If you run into locked .DLL problems when you test the release, as explained below, try selecting this check box.
      • Deployment script: The task gives you additional flexibility to run deployment script on the Azure App Service. For example, you can run a script to update dependencies (node packages) on the Azure App Service instead of packaging the dependencies in the build step.
      • Generate web.config: In case you are deploying a Node.js application which was not created by using Node.js Tools for Visual Studio then the task will help you generate the web.config required to run the Node apps on Azure App Service.

    This is required because Windows Azure App Service uses iisnode to host Node.js applications in IIS on Windows

  2. Type a name for the new release definition and, optionally, change the name of the environment from Default Environment to Dev. Also, set the deployment condition on the environment to “Automatically start after release creation”.
  3. Save the new release definition. Create a new release and verify that the application has been deployed correctly.


  1. js Tools for Visual Studio helps you develop Node.js applications by providing Visual Studio project templates as well as intellisense, debugging and profiling support.
  2. Windows Azure App Service use iisnode to host Node.js applications in IIS on Windows.


Discussion is closed.

Feedback usabilla icon