By default, an Azure virtual machine will receive a dynamic public IP, and as long as we keep it up and running that IP will not change. That is OK — depending on the nature of the application. However, in some cases — for example when we need to RDP to a server and the public IP keeps changing — that may become a challenge. Azure offers a great feature where we can assign a DNS name to the server, so even if the public IP changes, as long as you use the DNS name the connection will work.
We can configure a DNS name and use that to connect to our VMs. The process is straightforward. In the Overview page of any given VM, click on Configure located in the DNS Name item.
Assign a name for the VM in question, but keep in mind that suffix is being shown underneath the text field where we are defining the name of the VM. In our case, our VM will have the name vm001.canadacentral.cloudapp.azure.com. Click on Save.
We can use a DNS lookup site (in our example below, we are using MXToolbox) to see if the changes are in effect. As we can see the name is resolving to the public IP address of that instance.
Using this feature, the administrator can connect to the VM using DNS names instead of chasing them around with a dynamic public IP, which may change during the lifecycle of the server. When we check back in the Overview page of that given VM, we can copy the DNS name and use it accordingly.
Featured image: Shutterstock