16

I am looking to rename an Azure VM. I have copied a VM from one subscription to another using this guide:

http://blogs.msdn.com/b/microsoft_press/archive/2014/01/29/from-the-mvps-copying-a-virtual-machine-from-one-windows-azure-subscription-to-another-with-powershell.aspx

This has worked fine and I am happy with the newly created VM in my new subscription. However, the VM has retained the original system's name and I would like to rename this.

By "name", I mean the label that is given on the Azure portal on the following screenshot:

image

I have changed the host name of the new VM in the hope that it would reflect the change in this list, but to no avail. The DNS and all other settings are correct.

Is there any way I can change this without creating a new virtual machine? Perhaps there is a cmdlet which will allow this name to be changed or a hidden option in the portal?

David Makogon
  • 2,767
  • 1
  • 19
  • 29
Nick Chambers
  • 163
  • 1
  • 1
  • 5
  • 1
    You can copy VM using open source tool ADCMS. The Azure Data Center Migration Solution (ADCMS) is designed to address common migration scenarios, such as moving to a closer data center with lower latency; deploying the same solution configuration to multiple data centers; or even moving between subscriptions, such as from an MSDN test account to a full production deployment. Azure Data Center Migration Tool Blog blog.persistentsys.com/…/persistent-systems-releases-azure-data-center-migration-solution (http://blog.persistentsys.com/index.php/2015/01/06/persistent-systems-releases-azure-data-cen – Milind Patil Jan 18 '15 at 15:24
  • Here is a guide to deleting the VM and attaching an existing disk to it. You can also change the virtual network associated with the VM by doing this. http://blogs.msdn.com/b/walterm/archive/2013/05/29/moving-a-virtual-machine-from-one-virtual-network-to-another.aspx – Carlan Wray Feb 18 '16 at 12:59

2 Answers2

13

At this time, there is no way to rename a VM. You could try this as a workaround: Delete the VM while retaining all the Disks that were attached to it. Then recreate the VM with the new name and reattach the Disks that were attached to the original VM.

proteus
  • 664
  • 5
  • 12
0

Here is a powershell script to reploy a VM.

It is intended to add a VM to an availability group, which incidentally I needed to do at the same time I wanted to rename it.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/change-availability-set

I just modified it by adding a new parameter to the top

$newVmName = "RR-PROD-SIMON2"

and search and replaced $OriginalVM.Name for $newVmName

I'm not sure about capitalization rules, but I prefer to use all caps.

Simon
  • 1,301
  • 2
  • 15
  • 19