Run Azure self hosted agent as service

Run Azure self hosted agent as service

  1. Open a Command Prompt as an administrator.

  2. Run the following sc create command to create the service:

sc create my-agent binPath= "C:\Windows\System32\cmd.exe /c C:\agent\run.cmd"
  1. If you want to configure the service to start automatically with Windows, you can run the following sc config command:
sc config my-agent start= auto
  1. Start the service using the sc start command:
sc start my-agent

Ensure that you're running these commands directly within the Command Prompt and not within a PowerShell session to avoid any issues with command interpretation.

If you continue to encounter any issues, please provide more details, and I'll be happy to assist further.