Powershell Script to Reserve Public IP Address

Tags: azure, powershell, public ip, ip address

List current reserved ips in the active subscription:

Get-AzureReservedIP

Create a new one for a virtual machine in the active subscription:

New-AzureReservedIP -ReservedIPName "[MyIPAdressName]" -Location "[SubscriptionLocation]" -ServiceName "[VirtualMachineName]"

4 Comments

  • verasearch3 said Reply

    The public IP address is dynamic by default, so if you don't reserve it, it changes every time you deallocate your virtual machine. So you have to redo any DNS entries you have pointing to the old IP address.

  • verasearch3 said Reply

    Unless of course your DNS entry points to a server name instead of an IP address. In that situation, it doesn't matter, because your server name doesn't actually change. However, if you have an "A" record pointing to an IP address, then that IP address will need to be updated.

  • verasearch3 said Reply

    You can reserve an ip address but not assign it (yet) to a virtual machine, by using the command: New-AzureReservedIP –ReservedIPName "MyServer1IP" –Label "Server1IP" –Location "West US 2"

  • verasearch3 said Reply

    After creating a reserved ip address, you can then assign it afterwards by associating it with a virtual machine service: Set-AzureReservedIPAssociation -ReservedIPName MyReservedIP -ServiceName MyService

You must log on to comment.