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

  • Question

  • Hello all,

    I have just deployed one Virtual Machine as selfhosted agent for CICD. I followed all steps in the url (, 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\", "$PWD")
    PS C:\agent> .\config.cmd

    >> Connect:

    Enter server URL >
    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>



    • Moved by James Lee - MSFT Thursday, September 27, 2018 10:55 PM moving to vsts forum
    Wednesday, September 12, 2018 1:33 PM

All replies

  • 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, September 24, 2018 11:33 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."
    Monday, August 19, 2019 3:46 PM