This post looks at how to re-configure a local Azure DevOps agent when you need to change to a new pool or organization.
PAT Expired
I got a note that one of my personal access tokens (PAT) had expired, and I wanted to update the agent. I ran config, but saw this, I need to remove the config first.
However, when I ran “config remove”, which is how you can reconfigure an agent, I got this:
In the image, the agent config asks for the PAT to allow it to authenticate to be removed. Since the agent doesn’t store this, and I don’t have it anymore, I can’t enter this. I can remove the agent from the portal, but there’s an easier way.
The Local Config
If you show hidden files, and if you are in tech, you always ought to do this, you will see a few in the agent folder. I name mine Agent, and inside, you can see there are .agent, .credentials, and .credentials_rsaparams files.
If I remove these three files, the agent doesn’t know where or how to connect. I can then run the config and re-set up the agent.