Azure: Change VM name using Cmdlets

11,208

Set-AzureService does not change service name! It only changes deployment name and description. These properties are just kind of Meta-Data associated with the hosted service deployment. You cannot change cloud service name (**cloudservice**.cloudapp.net) by any means! You can only create or delete cloud service.

And, not you can't change VM's name via Azure PowerShell cmdlets, but most probably you can do this by remote power shell to the targeted VM. Please note that renaming a Windows machine always requires restart!

For information on how to use Remote Power Shell on Azure VM, please check out this article.

UPDATE

I think what you need is the UpdateRole action on the management API. It has parameter RoleName which is desribed as:

RoleName
Required. Specifies the name for the virtual machine. The name must be unique within Windows Azure.

And the powershell cmdlet to use is: Update-AzureVM

Share:
11,208
Dave New
Author by

Dave New

Updated on June 04, 2022

Comments

  • Dave New
    Dave New almost 2 years

    I erroneously named a virtual machine.

    Using the Azure Powershell I am able to rename cloud services using Set-AzureService. There doesn't seem to be a Set-AzureVM command to rename virtual machines.

    Is there another way to rename a virtual machine? I do not wish to change the VM's service name.

    EDIT, further clarity:

    I do NOT want to rename the cloud service name or the machine/computer name in the VM instance. I purely wish to change the associated name that my virtual machine is labeled with. i.e. the name you see in the portal

    The names in the column with the red arrow:

    enter image description here

  • Dave New
    Dave New almost 11 years
    Sorry if I wasn't clear. I understand that Set-AzureService only changes the 'deployment' name. I do NOT want to rename the cloud service name either. I purely wish to change the associated name that my virtual machine is labeled by. i.e. the name you see in the portal.
  • Dave New
    Dave New almost 11 years
    Edited post with the above comments.
  • astaykov
    astaykov almost 11 years
    Got it, never tried - but why don't you try with Set-AzureService? It might the Deployment Name that is displayed as "VM Name" in the portal. Not sure, never tried, but this might be the case ... At the end Azure VM is just a Hosted Service ...
  • Dave New
    Dave New almost 11 years
    I could use Set-AzureService to change the label of my cloud service which the virtual machine is associated too, but I don't want to change that. I want to change the virtual machine name. This is not an easy thing to communicate!
  • Nick Chambers
    Nick Chambers over 9 years
    Sorry to drag up this old thread, but was this issue resolved? I'm trying to do the exact same thing myself but information is sparse.