Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Azure virtual machine name in Azure portal

Tags:

Can we change the name of an Azure Virtual Machine in the Azure portal? I am sure we cannot change it via portal, do we have any PowerShell cmdlet to change the virtual machine name??

Note: I am not referring to VM name inside the VM, but the name that is displayed in the Azure Portal.

like image 556
Manjunath Rao Avatar asked Apr 10 '18 14:04

Manjunath Rao


People also ask

How do I rename my VM in Azure portal?

In this article, you have learned how to rename an Azure virtual machine using PowerShell. We first back up the VM configuration and export it to an (. XML) file for later reference, then delete a VM, package a new VM configuration, attach all disks and network profile, and finally creating the new VM.

How do I change the hostname on Azure Windows virtual machine?

Set the hostname with cloud-init By default, the hostname is the same as the VM name when you create a new virtual machine in Azure. To run a cloud-init script to change this default hostname when you create a VM in Azure with az vm create, specify the cloud-init file with the --custom-data switch.

How do I find my Azure VM name?

You can download the service configuration file for a deployed service from the Configure blade of the service in the Azure portal. You can then look for the vmName attribute for the Role name element to see the host name. Keep in mind that this host name is used as a base for the host name of each role instance.


1 Answers

Resource names for virtual machines are immutable. So, you will need to redeploy your virtual machine.

Best way to do this is to delete the current one, maintaining the disks, and then create a new one with the correct name pointing to those disks.

like image 123
Zair Henrique Avatar answered Oct 06 '22 23:10

Zair Henrique