Azure Virtual Machine - Configure Static IP Address

In the articles given below, we have learned how to create virtual machine, using the default configurations.

In both the articles, as shown below, we have used IP address to connect to the virtual machine, using RDP protocol.


By default, the IP addresses which we have used are dynamic IP addresses. This means, Azure can use the same IP address to some other machine at any point of time. For example, when we stop (deallocate) the virtual machine and then start the same we might see a different IP address. If you see the same IP address again after starting the virtual machine, it’s just your luck. This is definitely going to break your references of the IP address of a given virtual machine. The only way to get rid of this is to convert the Dynamic IP address to a Static IP address. In this article, we will discuss how to convert a Dynamic IP address to a Static IP address.

The screenshot of the overview tab of the virtual machine, which I just created is given below.


Click on the IP address shown in the screenshot above. You will be taken to the blade given below of the IP address settings.


By default, the assignment is dynamic. I just updated it to Static and clicked Save.

Clicking on Save button will start the process of saving the changes, as shown below.


After  a few seconds, the changes are reflected and you can view the changes in the virtual machine’s overview blade, as shown below.


DNS Name Label

You can also assign a DNS label to your IP address by providing a DNS name in DNS name label section of the IP address configuration blade, as shown below.


Once you provide a unique name, click on Save button to save the changes. You can view the DNS name label in the virtual machine’s overview blade, as shown below.


You can also use the DNS name to do a remote desktop, as shown below. This feature comes in very handy, if you don’t want to refer to the IP address of your virtual machine in any of your work. For example, while configuring your Load Balancers, in your code’s configurations, Custom Domains etc.


Other Important Notes

  • You have created a static public IP address, which also means you have created an Azure ARM object (Public IP Address) i.e. it's accessible over the internet.
  • The first 5 static public IP addresses per region are free, as per the IP address pricing of Azure Documentation.
  • You can create 20 Public Static IP addresses and 60 Public Dynamic IP addresses per region per subscription as of this writing. For more details and the latest information, please check the official documentation at Azure subscription and Service limits, quotas and the constraints.

Hope you enjoyed reading the article. Your feedback is appreciated.

Summary

In this article, we have learned the following.

  • Converted a Dynamic IP address to a Static IP address.
  • Created a DNS label for an IP address.