IP Addresses in Azure Virtual Machines[IAAS]

IP Addresses in Azure:

In the classic portal or when you do the classic deployment we have the commands “Set-AzureReservedIPAssociation” and “Set-AzurePublicIP” to create Public Reserved IP and Instance Level Public IP respectively.

Now, there may be a slight difference how these IPs behave when you deploy a VM using the new deployment model which is the “Resource Manager” type. The above commands wouldn’t work for the new deployment Model.

ip1.png

Assigning Dynamic Public IP to VM: (using Portal)

When you deploy a VM to one of your Virtual Network, you can configure the Public IP during this time.

ip2.png

The IP is dynamic which means it might change when you reboot the server

Assigning Static Public IP to VM: (using Powershell)

You can list all the IP Addresses allotted to your resource group name using Get-AzureRmPublicAddress. In the below picture we can see there is one dynamic IP

ip3.png

Now, let’s try to get one Static Public IP using PowerShell. Here are the command for the same.

ip4.png

Now lets run the Get-AzureRmPublicAddress again and now we can see another IP in this resource group and this is Static.

ip5.png

You can bind this to a VM from Azure Portal or through powershell Set-AzureRmPublicIpAddress

**Now the difference between these IPs are, the static IP will be reserved even after the machine is re started”

Assigning Static/Reserved IP to Cloud Service:

You cannot assign static IP to web role or Worker role instances but you can assign it to the cloud service only.

Here I am creating a reserved IP and assigning it to my cloud service

ip6.png

And now you can assign using

Set-AzureReservedIPAssociation -ReservedIPName reservedIpForCloudService -ServiceName “yourservice” (you can run get-AzureService to get the servicename)