Share via


Self-hosted CICD, get Needs Administrator privileges for configuring agent as windows service

Question

Wednesday, September 12, 2018 1:33 PM

Hello all,

I have just deployed one Virtual Machine as selfhosted agent for CICD. I followed all steps in the url (https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=vsts), however, I got the message when I select agent run as service. It's "Needs Administrator privileges for configuring agent as windows service" message.

I use the same account (azure account) for log in VM, create agent and generate access token. It have administrator permission on VM and agent pool. Besides that I also added my account into "Log on as a service" policy at Local Security policy screen but it does not work.

Thanks for reading and please help me to give your idea/comment on it.

I could not attach image into this post because of limitation of account type so I just paste all text of screenshot below.

The information of command and text in powershell screen:

PS C:\agent> Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirecto
ry("C:\agent\vsts-agent-win-x64-2.140.0.zip", "$PWD")
PS C:\agent> .\config.cmd

>> Connect:

Enter server URL > https://dev.azure.com/YYYY
Enter authentication type (press enter for PAT) >
Enter personal access token > ******
Connecting to server ...

>> Register Agent:

Enter agent pool (press enter for default) > TestAgentPool
Enter agent name (press enter for JL-WIN10) > AgentNameTest
Scanning for tool capabilities.
Connecting to the server.
Successfully added the agent
Testing agent connection.
Enter work folder (press enter for _work) >
2018-09-12 12:41:21Z: Settings Saved.
Enter run agent as service? (Y/N) (press enter for N) > Y
Needs Administrator privileges for configuring agent as windows service.
PS C:\agent>

Thanks,

Tony

All replies (2)

Monday, September 24, 2018 11:33 PM

Hi Tony

It looks like it's been some time since you have posted this question here. Even though you didn't get a resolution here yet, were you able to get this issue resolved through different means/methods?

If so, would you kindly share the solution with us here so that others visiting this post can learn from it?


Monday, August 19, 2019 3:46 PM

I have the same issue.  How do we get admin priviliges?  Even when my account is in the Administrators group, and I run cmd.exe "As an Administrator", I still get the message "Needs Administrator privileges for configuring agent as windows service."