3

I am running this command on Azure Power Shell to assign a reserved public IP to an existing virtual machine:

PS C:\> Get-AzureVM -ServiceName sk-cs-name -Name sk-vm-name | Set-AzurePublicIP -PublicIPName sk-public-ip | Update-AzureVM

VERBOSE: 10:56:53 AM - Completed Operation: Get Deployment
VERBOSE: 10:56:57 AM - Completed Operation: Get Deployment
VERBOSE: 10:56:57 AM - Begin Operation: Update-AzureVM
VERBOSE: 10:58:00 AM - Completed Operation: Update-AzureVM

OperationDescription                    OperationId                             OperationStatus
--------------------                    -----------                             ---------------
Update-AzureVM                          b34a1f44-68be-784f-b528-34f5599106ab    Succeeded

The OperationStatus is Succeeded but nothing happens after running this command. The public ip assigned to sk-vm-name does not change and I cannot access to this machine by typing the reserved ip into the browser.

What am I doing wrong?

Serhat Ozgel
  • 131
  • 1
  • 1
  • 3
  • If you are using an existing Virtual Network where the VMs are part of an Affinity Group bound VNet then Reserved IPs cannot be used. You need to tear down the network and reprovision it to use Reserved IPs. – Simon W Mar 12 '15 at 05:27

1 Answers1

6

You can't assign reserved ips to existing VMs or Cloud Services atm. You have to redeploy. Here are the basic steps:

  1. Select your VM and go to Dashboard. Take note of the main disk name.
  2. Delete the VM with the option to keep vhds.
  3. Delete the cloud service
  4. Reserve an IP in the same location as your vhds. Example:

    New-AzureReservedIP – ReservedIPName "MyReservedIP" –Label "ReservedLabel" –Location "Brazil South"

  5. Redeploy the VM using the same disk and properties.

    New-AzureVMConfig -Name "VMName1" -InstanceSize "Large" –DiskName "DiskName1" | New-AzureVM -ServiceName "CloudService1" –ReservedIPName "MyReservedIP" -Location "Brazil South" -VNetName "Vnet1"

Update:

You can now assign reserved VIP without having to redeploy

New-AzureReservedIP -ReservedIPName MyReservedIP -Location "East US"

Set-AzureReservedIPAssociation -ReservedIPName MyReservedIP -ServiceName TestService
Bruno Faria
  • 3,814
  • 1
  • 13
  • 18
  • Can I do that and easily move my data from the existing VM to the new VM? – Stavros Jun 13 '15 at 07:51
  • You can keep the disk and just recreate the VM settings like network, sizing, etc. but this topic is rather old. You can now assign reserved public ips without having to redeploy. I've updated the answer with the proper cmdlets. – Bruno Faria Jun 13 '15 at 13:12
  • Can you please provide a link with the documentation? – Stavros Jun 22 '15 at 07:42
  • Sure. https://msdn.microsoft.com/library/azure/dn376542.aspx/ and https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-reserved-public-ip/ – Bruno Faria Jun 22 '15 at 20:04