Step-By-Step: Assigning a Reserved IP Address to an Azure VM

IP address assignments in Azure are dynamic by default and can possibly change when a VM is restarted. Azure VMs can also be assigned static IPs.

So why would you need to assign a static IP addresses to an Azure VM?

1) Application requirements – sometime applications need to connect with fixed IP address. For example, if it’s a database VM it’s important to have static IP address so application settings always can refer to that.

2) Security – when VM uses static IP addresses we can create firewall rules easily. So there is more control over traffic flow as well.

In Azure, static IP address (public) is count as a service so there will be addition charge for it.

In Azure there is 2 methods to deploy and manage a VM.

1)  Classic Mode

2) Resources Manager

Assigning a static IP address (public) is different for these 2 methods. In this blog post I am going to demonstrate how to do it using both modes.

Assign Static IP Address in classic deployment model

Before we start need to make sure following prerequisites are in place.

  • Global Administrator account for the Azure Subscription
  • Azure PowerShell Module installed in local computer – you can download it from https://aka.ms/webpi-azps

In my demo I got a classic virtual machine running and it’s got dynamic public IP address assigned. In demo I am going to show how we can make it as reserved IP address.

1) Log in to PC where Azure PowerShell Module installed and open the powershell as administrator

2) Then type Add-AzureAccount and press enter

3) Then it will prompt for the azure credential and login as global administrator

4) Then type New-AzureReservedIP –ReservedIPName DCM01ReservedIP –Location "East US" -ServiceName DCM01  – in the command DCM01ReservedIP is the name for the reserved IP address and Location define the location of the IP address ( can be US, Europe etc.).

5) Now it’s done and when I go to DCM01 VM now its shows the IP address as reserved.

6) Also in power shell type Get-AzureReservedIP and it will show the reserved IP details

Using Resource Manager deployment mode

In the resource manager I have a VM running and the public address by default. I need to change it to static.

1) To change click on the VM from the virtual machine container

2) Then click on the public IP address and DNS name

3) Then it will load the configuration and to change click on the configuration option

4) It will then list down the public IP configuration, as can see by default its dynamic to set it to static need to click on static option and click on save. This will make the IP address static.

Hope this post was helpful and if you have any question feel free to comment below.