question

Primordialsuser-3858 avatar image
Primordialsuser-3858 asked ·

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

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-machineswindows-10-setup
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

rohanislam avatar image
rohanislam answered ·

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://docs.microsoft.com/en-us/azure/virtual-machines/windows/prepare-for-upload-vhd-image?toc=/azure/virtual-machines/windows/toc.json

Azure Image Builder: https://docs.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

Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.