# Elastic agent / fleet server fails to install /connect to elastic search - Error: certificate is required when certificate private key is provided

**URL:** <https://discuss.elastic.co/t/elastic-agent-fleet-server-fails-to-install-connect-to-elastic-search-error-certificate-is-required-when-certificate-private-key-is-provided/296516>\
**Category:** Elasticsearch\
**Tags:** fleet\
**Created:** [February 7, 2022, 7:15pm UTC](https://discuss.elastic.co/t/elastic-agent-fleet-server-fails-to-install-connect-to-elastic-search-error-certificate-is-required-when-certificate-private-key-is-provided/296516 "2022-02-07T19:15:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajj31](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@ajj31](https://discuss.elastic.co/u/ajj31)\
**Post date:** [February 7, 2022, 7:15pm UTC](https://discuss.elastic.co/t/elastic-agent-fleet-server-fails-to-install-connect-to-elastic-search-error-certificate-is-required-when-certificate-private-key-is-provided/296516/1 "2022-02-07T19:15:24Z")

</div>

sudo ./elastic-agent install --url=https://szu.azhszzz.com:8220 --fleet-server-es=https://szu.azhszzz.com:9200 --fleet-server-service-token=AAEAAWVsYXN0aWMvZmxlZXQtc2VydmVyL3Rva2VuLTE2NDQxNDU0Njc3NDY6eDR4UTVSZ3lUbi1FS0dJbzRmbEFDQQ --fleet-server-policy=499b5aa7-d214-5b5d-838b-3cd76469844e --certificate-authorities=/home/user/siza/elastic-agent-7.16.3-linux-x86\_64/ca.crt --fleet-server-es-ca=/home/user/certs/fleet-server.crt --fleet-server-cert-key=/home/ec2-user/certs/fleet-server.key  
Elastic Agent will be installed at /opt/Elastic/Agent and will run as a service. Do you want to continue? [Y/n]:Y  
Error: certificate is required when certificate private key is provided

Elasticsearch , kibana and logstash are all all running fine with these certificates and Keys

The error wouldn't tell which key has been put instead of certificate ?

fleet-server.key is the only key in the command above as per instructions in kibana config for elastic agent.

Kindly help since i havent seen this error in any forums.

---

<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 7, 2022, 7:15pm UTC](https://discuss.elastic.co/t/elastic-agent-fleet-server-fails-to-install-connect-to-elastic-search-error-certificate-is-required-when-certificate-private-key-is-provided/296516/2 "2022-03-07T19:15:38Z")

</div>

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