Is there any way to remove VSTS agent without PAT?

Viewed 28319

I'm trying to remove a VSTS agent from a system, but I no longer possess the Personal Access Token (PAT) originally used during setup. An answer on this thread states that I can just delete the agent from the VSTS web UI, but I don't see that option besides nuking the entire agent pool (which is not a great option for us).

When I try to run config.cmd remove, these are my results:

PS C:\agent> .\config.cmd remove
Removing agent from the server
Enter authentication type (press enter for PAT) >
Enter personal access token >
Enter personal access token > Exiting...
1 Answers

First, it’s better to remove VSTS agent through config.cmd remove command and the PAT is required, you don’t need to use original PAT, you can apply a new PAT with Agent Pools (read, manage) scope and use it to remove agent.

Secondly, without PAT:

Deleting agent from server:

enter image description here

Deleting agent service in local system through sc command if it is running as service: sc delete [service name].

After that, you can delete the agent files.

Related