Run Azure self hosted agent as service

Hey there! I'm currently working as an Associate DevOps Engineer, and I'm diving into popular DevOps tools like Azure Devops,Linux, Docker, Kubernetes,Terraform and Ansible. I'm also on the learning track with AWS certifications to amp up my cloud game. If you're into tech collaborations and exploring new horizons, let's connect!
Open a Command Prompt as an administrator.
Run the following
sc createcommand to create the service:
sc create my-agent binPath= "C:\Windows\System32\cmd.exe /c C:\agent\run.cmd"
- If you want to configure the service to start automatically with Windows, you can run the following
sc configcommand:
sc config my-agent start= auto
- Start the service using the
sc startcommand:
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.




