How To Reserve Public IP Address In Azure

At work we have started to deploy development, test and production environment to Windows Azure. We have an application that use a web and sql server, in addition to its own AD controller. One of the components in our application use SMTP email server, and after some investigation we decided to use our company’s SMTP server. As a result we need to assign a fixed IP address to the server(s) that shall use the company SMTP services. This IP address has to be granted access to the SMTP server.

The following powershell commands will reserve an public IP adress to the name ‘mytestappip’.

$ip_test_app = "mytestappip"
$location = "North Europe"
New-AzureReservedIP -ReservedIPName $iptestapp -Location $location

Write-Host "test web: " $ip_test_app

Now, we have a reservered, static IP that will remain ours. You can retrieve informaton about an reservered IP with the following Powershell command:

Get-AzureReservedIP -ReservedIPName "mytestappip"

This IP address can now be used when a virtual machine is created. This virtual machine will have this IP address even if the virtual machine is turned off (deallocated). Normally, Windows Azure will release IP addresses for VMs that is turned off completly.

At this time, the first 5 IP addresses are free, but the pricing is found here. You can remove any until we decide to remove it by the command Remove-AzureReservedIP

Remove-AzureReservedIP -ReservedIPName "mytestappip" -Force