Elastic Agent - Metricbeat events being dropped with status code 400

I am trying to install a fleet managed elastic agent on a freshly installed ubuntu server. Elastic agent installation is successfull but I am not getting any events to Kibana.

When I went through the logs, I was able to see that metricbeat events being dropped with status code 400.