Creating an instance of a VM from an image does not behave as expected

Primordials user 1 Reputation point
2020-05-24T17:56:21.73+00:00

I have a problem with creating VM instances from a VM image.
I have created an image and prepared it before the actual creation with sysprep.exe.
I have some files on it, a scheduler, IIS etc. set up.
When i created the new instance all the files were there, but when i first logged in it seemed as a fresh copy of windows was installed, also, the scheduler did not fire off.
When i double clicked on the file that was suppose to start my app instead of starting it, it requested an install. (the app was deployed via visual studio and installed on the VM before the image was created).
The Scheduler that is suppose to start the app on startup should run about 30 sec after windows booted, and to make it work i had to edit registry to work.
The problem is that none of those things happened. The expected behaviour is that i would get a copy of the VM in the last state before the image was created, and that the scheduler and the app would run on start. However that does not happen.

Does anyone know why? Or can anyone help so i could actualy created the instances of VM and expect to work as i just copied all the options from the previous one?
I am testing VM scale sets together with load balancer so i could scale to more VM-s if one of the VM-s would be overburdened, but the instances dont behave as expected.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,514 questions
Windows 10 Setup
Windows 10 Setup
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,919 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rohan Islam 106 Reputation points
    2020-05-26T04:44:45.41+00:00

    Hi,

    The following links might be helpful. Please note that every application or role that is installed on a VM may not be supported by sysprep or generalised image and end up in broken state. If you are trying to prepare a gloden image, I suggest you follow the CIS guide line, Azure image builder is on the way, you can give it a try. If you just want a copy of the existing VM, you can try taking snapshot of the disk and deploy a new VM with them.

    Prepare Windows VHD: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/prepare-for-upload-vhd-image?toc=/azure/virtual-machines/windows/toc.json

    Azure Image Builder: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/image-builder-overview

    CIS hardened images: https://www.cisecurity.org/cis-hardened-images/microsoft/

    Thanks,
    Rohan | Azure Architect

    0 comments No comments