Terraform Azure Machine name

I’m new to terraform and am following

Configure Linux VM in Azure using Terraform

but only have public_ip for connection.

Is there way to setup Terraform Azure so that I can use machine names instead of public ips to connect to them? The machine names does not necessary need to be a public DNS, even intranet DNS would be find with me.