How to continuously deploy Node.js Application to Azure App Service with Visual Studio Team Services

How to continuously deploy Node.js Application to Azure App Service with Visual Studio Team Services

by Ajay Tiwari 30th May, 2017.

Node.js developers often face challenges to deploy their application continuously on Azure App Service. Here are few simple steps that can help you in deploying Node.js applications to Azure App Service continuously.

Push code to Repository:

  • Install Node.js tools in your Visual Studio Setup and create a sample Node.js application.
  • Now, push the code to your VSTS account using GIT or Team Foundation Version Control.

Build Steps

  1. Open your project in the team services account.
  2. Select Build & Release menu and under the Builds tab, select +New to create a new build definition.
  3. Select Empty as the build definition.
  4. Add the below build tasks.

    npm install

    • Working folder : Set it to the root of the repository
    • Npm command : install

    Gulp

    • Gulp File Path : Gulpfile.js
    • Arguments: –packageName=$(Build.BuildId).zip –packagePath=$(Build.ArtifactStagingDirectory)

    Publish Build Artifacts:

    • Copy Root: $(Build.ArtifactStagingDirectory)
    • Contents: $(Build.BuildId).zip
    • Artifact name: drop
    • Artifact Type: Server
  5. Save and queue the build. Ensure the trigger is selected as "Continuous Integration"

Release Steps

  1. Go to the Releases tab of the Build & Release menu and select Create a Release Definition.
  2. Select a template, Azure App Service Deployment and click OK.
    Create Release Definition
  3. Select the build definition you created earlier as the source of artifact to be deployed.
  4. Configure the Azure App Service Deployment task:
    • Azure Subscription: Select a connection from the list under Available Azure Service Connections
    • App Service Name: Provide a App Service name
    • Deploy to Slot: Select the default
    • Package or Folder: $(System.DefaultWorkingDirectory)\**\*.zip (the default)
  5. Provide a name for the new release definition and save it.
  6. Create a new release and verify that the application has been deployed correctly.

Saviant at a glance

Saviant is the preferred Data Analytics & Intelligent Solutions partner for leading Asset-intensive and Field-force driven Enterprises across industries like Energy, Utilities, Logistics & Construction. We are the trusted Technology Advisors and Implementation Partners for their strategic initiatives around Data Analytics, IoT, Cloud & Mobility. Our teams enable intelligent actions & accelerated business outcomes for our customers across the globe, by defining their Technology Roadmap & Implementation Strategies.
Saviant is a Microsoft Gold Partner for Cloud Platform, Data Analytics, Application Development & Xamarin Premier Consulting Partner.

Read More