Patching and republishing custom VM images for VMSS non destructively

Question

I could use a senior person's advice on this, as this is a tough nut to crack.

Intro: I was tasked with taking an existing, kind of expensive Azure VD setup and migrating it to something leaner and more efficient.

I wanted to use VMSS with dynamic autoscaling (less manual intervention, lower risk of human error), so I looked into how the VMSS would create new machines. This would require a machine image, but we have custom software, so I made an Azure image gallery (private) with a custom image definition and version (Specialized) with the software preinstalled.

Issue 1: From my reading, a Specialized image will cause problems, as any host instantiated from that image will have the same hostname, therefore creating the risk of machine name conflicts on the network/in DNS and require manual corrective actions. Which we don't want for an autoscaling system.

Issue 2: The alternative to the Specialized image is a Generalized one (equivalent to running Sysprep on the original VM). But this creates other potential issues: the resulting machines need a hostname and local admin credentials at boot, which if they're being instantiated automatically by the VMSS, they're not going to have (unless...? Correct me if I'm wrong).

Issue 3: Finally, producing either a Generalized or a Specialized image from a VM will render that VM inoperable, which is absurd because I want to keep that VM to produce future image versions with updated patches, apps etc. I read that the VM should be snapshot before being generalized and captured, but in my experience creating a snapshot also renders the VM unusable. Am I right? Or was my snapshot VM rendered unusable by another cause? (Note: I placed my snapshot in another Azure subscription, this might have affected the snapshot VM)

So basically I am trying to build a safe, repeatable process for patching and republishing my custom image. What I've got so far is:

- Have a "golden" VM on hand

- Do patches on the VM

- Snapshot the VM

- Capture image (Generalized?)[breaks the VM]

- Publish new image version in Image Gallery from capture

- Apply snapshot to VM [fixes the VM back up??]

- Wait for next patch cycle

Does this look logical at all to you?

Posted Jul 30, 2026, 2:06 PM UTC

08
Loading comments…