Add Custom Domain to Virtual Machine in Microsoft Azure

You cannot tell user or Search Engine to use Public IP to access your site. Plus, Public IP changes unless you pay extra bucks to get static Public IP.

To add custom domain to your Azure VM, you must have an idea of CNAME and A record.

As Public IP changes and we had to spend some money to get static Public IP, so I’m using CNAME here instead of A record.

From yor Resource Group in, which your VM is sitting, choose Public IP > Settings >  Configuration choose available DNS Name Label.



So, now your DNS name label will be Meaning, you can access your website using this URL. Now, you have to align your custom domain with this DNS name label.

Now, go to your DNS provider site and manage DNS settings. In my case, it is NameCheap.

Fill the feilds as followed (according to your DNS name label)


Save the DNS settings and you’re all set!


Now you can access your VM using your custom domain name.

Got questions? Feel free to ask ’em in comments.

Ahmed Khateeb

Computer Scientist, Former intern at Microsoft, Developer and Blogger. "Tech Enthusiast".

Leave a Reply

Your email address will not be published. Required fields are marked *