简体   繁体   中英

How to remove pipeline's access to self hosted agent (without the original PAT or access to the azure devops)?

Following are steps followed to setup the self hosted agent.

  1. Create a azure devops organization
  2. Create personal access token (PAT) with manage agent permissions
  3. Create an agent in azure devops
  4. On the target machine download the zip, unzip, run ./config.cmd
  5. Enter url, PAT

Now the agent is ready to be used for release pipeline deployments. Now I want to remove the agent so I run .\config remove . It asks me for the PAT which I don't remember.

I don't have access to the azure devops anymore (so cannot generate new PAT). My goal (ad this question) is regarding removal of the agent service from the machine. Whether or not it removes the agent from the azure devops is irrelevant. Any advise?

Maybe it is sufficient to just delete the C:\agent folder after the above command error?

在此处输入图像描述

I will leave formal answer, just in case.

In your case, you do not have access to Azure DevOps longer and you are not able to generate or re-generate PAT token. No problem, it is not big issue, the agent software is a connection between your (a) Server and (b) Azure DevOps. So if you do not have access to Azure DevOps, you can not do any thing about it. What you need to focus on, is uninstalling the agent software from (a) Server so it is no longer connected to (b) Azure DevOps.

Normally to remove agent, just use .\config remove as you already have done in our question, and ignore server errors, the only reason server requires PAT again, is to allow removing the agent from Azure DevOps remotely, hence you do not have access Azure DevOps longer, just ignore the messages, it will removing the files. Delete the folder and that is it.

In case you get troubling or fail removing files using .\config remove , than you have to do manual removal. You have 2 options below:

  • If you have installed the agent as Service. Stop the service and deleting agent service in local system through: sc delete [service name] .
  • If it is just running in command line. Stop the command line.

When one of the options is done. delete your agent folder. Now your Server is not longer connected to Azure DevOps. And you can use it for another Azure DevOps agent installation.

Reference:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM