Azure → Virtual Machine Scale Sets

Subhash Chand 0 Reputation points
2026-01-22T08:04:47.0333333+00:00

Hello Microsoft Community Team,

I am currently running multiple applications on Azure Virtual Machine Scale Sets (VMSS) and would like guidance on industry best practices for managing deployments.

Current Setup

I have 12 different projects running on a VMSS.

The VMSS is created from a custom image (captured from a parent VM).

  • New VM instances are provisioned only from this image .

Some projects require:

npm install

  `npm run build`
  
     Others are already built and only need runtime execution.
     

Problem Statement

I push code updates daily. My current concern is:

Do I need to create a new VM image every day after each code change?

If not, what is the recommended way to:

Deploy frequent code updates

  Handle different build requirements across multiple projects
  
     Keep VMSS instances consistent and scalable
     

Questions

  1. What is the recommended industry approach for handling frequent deployments on VMSS?
  2. Should VM images be treated as:
    • Immutable base images (OS + runtime only), or
    • Fully baked images including application code?
  3. How should I manage multiple Node.js projects with different build steps on the same VMSS?
  4. Hello Microsoft Community Team, I am currently running multiple applications on Azure Virtual Machine Scale Sets (VMSS) and would like guidance on industry best practices for managing deployments.

    Current Setup

    • I have 12 different projects running on a VMSS.
    • The VMSS is created from a custom image (captured from a parent VM).
    • New VM instances are provisioned only from this image.
    • Some projects require:
    • npm install
    • npm run build
    • Others are already built and only need runtime execution.

    Problem Statement

    I push code updates daily.
    My current concern is:
    • Do I need to create a new VM image every day after each code change?
    • If not, what is the recommended way to:
    • Deploy frequent code updates
    • Handle different build requirements across multiple projects
    • Keep VMSS instances consistent and scalable

    Questions

    1. What is the recommended industry approach for handling frequent deployments on VMSS?
    2. Should VM images be treated as:
      • Immutable base images (OS + runtime only), or
      • Fully baked images including application code?
    3. How should I manage multiple Node.js projects with different build steps on the same VMSS?

FYI i am not using docker and k8

Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
{count} votes

1 answer

Sort by: Most helpful
  1. Himanshu Shekhar 3,375 Reputation points Microsoft External Staff Moderator
    2026-01-27T04:17:07.18+00:00

    @Subhash Chand You do not need to create a new VM image every day we can suggest using the image as a stable base and deploy app changes via automation on top of the VMSS - https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-deploy-app

    Do I need a new image per code change - Microsoft shows two main options for VMSS app deployment:

    1. custom image with app preinstalled, or
    2. base image + install or update scripts orextensions

    Always Use VMSS with immutable base images: OS, security hardening, monitoring agents, Node.js runtimes and common tools.

    1. Deploy app versions through automated mechanisms - Create and deploy VM Application - https://learn.microsoft.com/en-us/azure/virtual-machines/vm-applications-how-to?tabs=TAR%2Ccli1%2Ccli2%2Crest3%2Crest4
    2. Custom Script Extension to download and install/update the app.
    3. VM Applications to package the app, upload to Storage, and assign that VM Application version to the VMSS. Use VMSS upgrade policy to roll changes through instances, combined with health checks.

    Immutable vs fully baked images - Both are valid and the choice is about cadence and complexity.

    1. Immutable base image (OS and runtime only)
    2. Image updated when OS,Node,runtime,baseline changes.
    3. App code delivered via scripts,extensions,VM Applications.
    4. This is best when you deploy code often and want fast iterations without image churn.

    Fully baked image (OS and app)

    1. CI pipeline builds app, creates/validates an image (e.g., Packer), then VMSS upgrades to this image. Very fast scale-out, simple runtime, and easy rollback by switching to previous image version.
    2. This is best when you want strict immutability and can afford an image build pipeline per release.
    3. For your daily pushes, 12 apps, no containers scenario, base image + app deployment (extensions/VM Applications) is typically more practical

    For deploying of frequent updates to multiple Node.js apps

    Build Node.js projects in CI (npm install, npm run build, tests), then publish artifacts (zip/tar with compiled JS and minimal node_modules) to Storage or artifact reposiory.

    For VMSS: Always use Custom Script Extension configuration (JSON) that pulls the right artifact version and swaps symlink or folder, then restarts services or define a VM Application version that contains payload + install/update scripts and assign it to the VMSS application Profile. - https://docs.azure.cn/en-us/virtual-machines/extensions/custom-script-linux

    Then, reapply extension or update VM Application version when you deploy a new build. VMSS then updates instances according to the upgrade policy - https://docs.azure.cn/en-us/virtual-machine-scale-sets/tutorial-install-apps-cli

    For handling different build requirements (12 projects) - Standardize runtimes on the base image and install all required Node.js versions and shared tools (pm2, systemd units, reverse proxy) in the image - https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/

    Keep per-project logic in scripts:

    1. One bootstrap script that, for each project, downloads its artifact, applies config, and restarts that project’s service.
    2. Services defined per app (systemd units or pm2 processes) so you don’t restart everything for one change.
    3. Projects that only need “runtime execution” just get their pre-built artifact; projects that need a build step get it done in CI, not on the VM.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.