Assign a reserved IP to a running Azure virtual machine

Below instructions apply to classic (old) Azure portal only!

It’s tricky, and if you do not have a lot of patience, put on the stove a good cup of tea/coffee (maybe not too strong) and take a good breath.

You can’t. Not on a running machine. What you have to do is:

  1. reserve the IP address ( )
  2. destroy the VM (remember to keep the disk, or you’ll cry)
  3. create th VM, assigning the new reserved IP

Remember to use the very same zone while defining the new VM.

It took a while for me to understand all the relevant command, mostly beacuse all the documentation around the globe assume that you have a good skill with powershell (which I don’t have, I’m a GNU fan, how the heck I’m here dealing with Azure…).

Maybe the following commands might be useful. As always, do not copy and paste but do some research before compulsively click the middle mouse button – if you are on Linux, of course! :)

Remember to set your Azure Subscription your commands need to find the VHD you’ll reference later:

Set-AzureSubscription -SubscriptionName BizSpark -CurrentStorageAccount portalvhdaaaaaaaaaaa

The web interface is not totally useless. This time I took the DiskName from the “add new VM” feature. I’m sure there are PS commands which do the same, but I’m in a hurry this time:

New-AzureVMConfig -Name "machine-name" -InstanceSize Small -DiskName "[you find this while creating a new machine from the web interface "my disks"]" | Add
-AzureEndpoint -Name "HTTP" -Protocol "tcp" -PublicPort 80 -LocalPort 80 | New-AzureVM -ServiceName "service-name" -ReservedIPName reserved-ip-name -Location "West Europe" -VNetName your-net-name

Will most probably complain that the service name is already taken, this is because you did not deleted the service associated to the VM. You then will probably go to the management portal and assign few endpoints/ACL.

Davide Dal Farra
2017-05-05 00:00:00 +0000 UTC