Resolving hostname while installing Elastic Agent

Hi community. I had a setup to access interface via hostname instead of IP adress.
While trying to deploying agents on Windows machines via ELASTIC FLEET they can not resolve.
I know editing the hosts file will fix problem but any other solution if you guys can suggest ?