Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure VM: Adding a Reserved IP address to an existing VM

What I have read so far on the web is that there is no way to add a reserved IP to an existing VM (unless I recreate the VM which I am trying to avoid). However, I have noticed that external IP of my VM and the cloud service is same.

  1. Reserved IP Addresses page explains how to "To use a Reserved IP with Cloud Services". I have looked everywhere in the Azure Management Portal but couldn't find a configuration setting for Service Configuration Schema.

  2. I am using the Azure scheduler to turn-off the VMs at night and on the weekends. From the following I understand is that there is something that I need to write in the scheduler script to re-assign the Reserved IP when the VM starts in the morning. Did I get it right?

    Shutdown VM - Previously, when all the Virtual Machine instances in a cloud service were moved to the Shutdown state (stop/deallocated), the public IP would be released and a new public IP would be assigned when one of the Virtual Machines instances was started. However, with this release, if the VM uses a Reserved IP, then the Reserved IP can be used when re-deploying the VMs.

P.S. Is Stack Overflow the best place to ask this sort of questions relating to Azure or shall I use Server Fault in the future? I have seen Azure questions in both websites.

like image 335
Oxon Avatar asked Feb 11 '15 12:02

Oxon


People also ask

How do I reserve an existing VM in Azure?

All you have to do is to go to Azure Portal >> Navigate to All Services >> Reservations >> Click Add >> Define a scope and create. And here's how you pay for it: For Enterprise Agreement (EA) customers, Azure Monetary Commitment can be used to purchase Azure Reserved VM Instances.


3 Answers

In order to assign existing reserved IP to an existing VM, you can use the following command:

Set-AzureReservedIPAssociation -ReservedIPName MyReservedIP -ServiceName TestService
like image 178
Zeeshan Avatar answered Oct 16 '22 05:10

Zeeshan


At Build 2015 they announced this is now possible and VERY easy. Simply open Azure powershell and run this:

New-AzureReservedIP -ReservedIPName "ipname" -Location "West US" -ServiceName "somevm"

If you run this it will reserve an IP named "ipname" and associate it with the already deployed instance "somevm.cloudapp.net"

like image 38
artfulhacker Avatar answered Oct 16 '22 04:10

artfulhacker


Step by step to create Reserved IP and using it on Azure VM. Here you can go

Reserved IP Creation

I have done the Elastic IP Automatic scheduling on AWS.Here is the reference link Elastic IP Automation on AWS script.

Between needs to check about How can I write a script for automating the reserved IP for Azure.If you had done it earlier, Kindly share the script this will be very useful. Thanks.

like image 44
prem Avatar answered Oct 16 '22 05:10

prem