You can unenroll Elastic Agents to invalidate the API key used to connect to Elasticsearch.
- In Fleet, select Agents.
- To unenroll a single agent, choose Unenroll agent from the Actions menu next to the agent you want to unenroll.
To unenroll multiple agents, bulk select the agents and click Unenroll agents.
Unable to select multiple agents? Confirm that your subscription level supports selective agent unenrollment in Fleet. For more information, refer to Elastic Stack subscriptions.
Unenrolled agents will continue to run, but will not be able to send data. They
will show this error instead:
invalid api key to authenticate with fleet.
If unenrollment hangs, select Force unenroll to invalidate all API
keys related to the agent and change the status to
inactive so that the agent
no longer appears in Fleet.