itye1970
itye1970

Reputation: 1985

Azure DevOps Agent won't start and shows: Error 1 Incorrect Function - Service could not start

I configured the build agent as a service but when I go to start the agent I get the error:

Error 1 Incorrect Function - Service could not start

Azure DevOps Agent configured as a service but service does not start

Upvotes: 7

Views: 12094

Answers (5)

Phil Morris
Phil Morris

Reputation: 136

Running from C:\Agent worked perfect for me after struggling for a few days

Installing on a different drive will work but results in the error. When you try this interactively, you realise the user doesn't have access to the root of the 'not C' drive.

Set 'Read' and 'List Contents' 'On this folder only' for the root of the drive so that the agent user can navigate past the root to the subfolder without revealing any other content.

Upvotes: 1

Desmond
Desmond

Reputation: 1368

This happens when the service Azure Pipelines Agent in the machine is set with Log On As NETWORK SERVICE.

To resolve this, we need to

  1. Right Click on the Azure Pipelines Agent
  2. Properties
  3. Click on LogOn tab
  4. select Local System Account

The final output should be as per the attached image.

enter image description here

Upvotes: 5

Blake Drumm
Blake Drumm

Reputation: 165

I changed my user to Local System (NT AUTHORITY\SYSTEM) in services.msc and it worked as intended. Azure Pipelines Agent Service

Upvotes: 16

Dennis Johnson
Dennis Johnson

Reputation: 43

Running from C:\Agent worked perfect for me after struggling for a few days.

Upvotes: 2

sirdank
sirdank

Reputation: 3571

Copied from the comments:

ok ill answer my own question, when the config.cmd command is run, it allocates the network service as the account to run the service. However it does NOT automatically give permissions to where the agent folders are installed. So it fails to run. Stupid as this should be flagged when running the config.cmd command! The error message is nonsense and misleading. So if the agent is in c:\users\abc\agent you need to give the network service permissions to access that folder!

Upvotes: 8

Related Questions