Start service on newly created VM from captured image

Eusebiu Marcu 201 Reputation points


I've created a VM (Windows) and I've registered a Windows Service (dotnet core 3.1) and marked it as Automatic.

After I capture that VM (because I want to create new VMs from that image, e.g. using Azure API) and create a new VM instance, the service I registered is stopped when the VM is booted.

How can I make that service start with the VM?


Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
4,865 questions
No comments
{count} votes

Accepted answer
  1. Eusebiu Marcu 201 Reputation points

    So, I moved from Image creation to Disk snapshot and create a VM from a copied disk from snapshot.
    I've also increased the time for service start timeout (I had a 1 vCPU and 2GB of RAM),)%2C%20as%20shown%20in%20Fig.

    Other option: Automatic (Delay start).

1 additional answer

Sort by: Most helpful
  1. TravisCragg-MSFT 5,636 Reputation points Microsoft Employee

    This should work, did you make sure the original image kept the service after a reboot? Sometimes dependencies or other factors can prevent the service from starting.

    You can also use a custom script extension (easy) or Desired State Configuration (complicated) to configure the service to start on creation.