# Fleet Admin user is invalid

**URL:** https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862
**Category:** Kibana
**Tags:** fleet
**Created:** [February 10, 2021, 11:33am UTC](https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862 "2021-02-10T11:33:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Robo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robo/32/38295_2.png) [@Robo](https://discuss.elastic.co/u/Robo)
#### Post date: [February 10, 2021, 11:33am UTC](https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862/1 "2021-02-10T11:33:31Z")

</div>

I'm trying to enroll an agent using fleet, but seems there is something wrong with the api\_key.  
Is there a was how to initiate again the fleet setup (including user and role)?  
How could be below mentioned error be solved?  
Latest version 7.10.2 is used.

Details:  
When starting an agent with fleet enroll:

```auto
    Error: fail to enroll: fail to execute request to Kibana: Status code: 400, Kibana returned an error: Bad Request, message: Fleet Admin user is invalid: [security_exception] unable to authenticate user [fleet_enroll] for REST request [/_security/api_key], with { header={ WWW-Authenticate={ 0="Basic realm=\"security\" charset=\"UTF-8\"" & 1="Bearer realm=\"security\"" & 2="ApiKey" } } }
    Error: enroll command failed with exit code: 1

```

When generating new enrollment token following error appears:

```auto
    Fleet Admin user is invalid: [security_exception] unable to authenticate user [fleet_enroll] for REST request [/_security/api_key], with { header={ WWW-Authenticate={ 0="Basic realm=\"security\" charset=\"UTF-8\"" & 1="Bearer realm=\"security\"" & 2="ApiKey" } } }

```

Thanks!

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [February 15, 2021, 9:39am UTC](https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862/2 "2021-02-15T09:39:03Z")

</div>

Hey @Robo ,

You can probably fix this by removing the default output

```auto
POST /.kibana/_delete_by_query
{
  "query": {
    "bool": {
      "must": [
        {
          "terms": {
            "type": [
              "ingest-outputs"
            ]
          }
        }
      ]
    }
  }
}

```

Then restarting Kibana and setup Fleet again from the UI should do the job.

Best,  
Oleg

---

<div class="post-metadata">

### Author: ![Robo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robo/32/38295_2.png) [@Robo](https://discuss.elastic.co/u/Robo)
#### Post date: [February 15, 2021, 11:00am UTC](https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862/3 "2021-02-15T11:00:16Z")

</div>

Thanks! Work as a charm. Also agent enrollment is working now without issues.  
Maybe this can be added into common problems troubleshooting.

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [February 15, 2021, 11:09am UTC](https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862/4 "2021-02-15T11:09:06Z")

</div>

> [@Robo](#):
>
> Maybe this can be added into common problems troubleshooting.

Glad it helped! That's a good idea, let me check with the relevant team if they can include this.

Best,  
Oleg

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 15, 2021, 11:09am UTC](https://discuss.elastic.co/t/fleet-admin-user-is-invalid/263862/5 "2021-03-15T11:09:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
