Reputation: 1985
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
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
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
The final output should be as per the attached image.
Upvotes: 5
Reputation: 165
I changed my user to Local System (NT AUTHORITY\SYSTEM) in services.msc and it worked as intended.
Upvotes: 16
Reputation: 43
Running from C:\Agent worked perfect for me after struggling for a few days.
Upvotes: 2
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