When you have an on premises environment you normally configure the virtual machines with static IP’s ( at least in most cases ). But what happens when you want migrate to Azure?
Well some things will need to ensure first:
- The Hyper-V Virtual Machine was created as Generation 1 VM.
- The Hyper-V Virtual Machine disk was created with VHD disk and not VHDX (if you have a VHDX, convert it with the Convert-VHD Windows PowerShell cmdlet) and confirm it sizes is less than 1023GB.
- The Hyper-V Virtual Machine has only ONE network adapter and that it is of type synthetic and NOT legacy.
- The network connection is configured to obtain its IP address automatically (static IP addresses within the VM will not work).
Last February Microsoft announced the support for static IP’s on the Virtual Machines. The Virtual Network static IP feature is now available through Windows Azure PowerShell (available at the Window Azure website.) . For the steps to install Windows Azure PowerShell, see: http://www.windowsazure.com/en-us/documentation/articles/install-configure-powershell/
The commands to setup the IP are:
#Get the Virtual Machine name
PS C:\> $VM = Get-AzureVM -ServiceName YourCloudServiceName -Name VMWeb01
#Update the Virtual Machine (in my case VMWeb01) with a static IP (10.1.2.30)
PS C:\> Set-AzureStaticVNetIP -VM $VM -IPAddress 10.1.2.30 | Update-AzureVM
Also ,
#Get the assigned IP address of a Virtual Machine
PS C:\> Get-AzureStaticVNetIP -VM $VM
#Removes the static IP address of the VM
Remove-AzureStaticVNetIP – VM $VM
#Confirm availability of a certain static IP address
Test-AzureStaticVNetIP -VNetName WebServersVNet -IPAddress 10.1.2.30
syntax: Test-AzureStaticVNetIP -VNetName <network name> -IPAddress <IP address string>
NOTES :
- The virtual machine guest operating system still have to be configured to get IP from DHCP (obtain IP address automatically)
- The configuration of a static IP address can only be done by using Windows Azure PowerShell. There is no GUI
- The Virtual Machine must be part of an Azure Virtual Network.
- As oppose of what many blogs says, you can specify the static IP at any time as long as the VM is stopped. The information that you can only configure a static IP address in the context of the CREATION of the Virtual Machine is not correct
Also Microsoft is now offering VIP Reservation for a virtual Machine, which means that the virtual IP address (public IP) won’t change for example if you move the VM to a different region (e.g. USA to Singapore) or removing and redeploying the services. This together with the ExpressRoute MPLS connections, will open many scenarios like SharePoint Hybrid, External Monitoring, Database backend…
