Renaming Azure VM is simple but not easy. Following this blog you can rename azure vm in 4 various option.
For various reason you want to rename newly created or existing azure vm name but changing the name for azure vm is not a simple rename task like in the file explorer. Because when you create a VM, Microsoft Azure create and assign various dependencies like Network card, IP address, virtual disk, etc.,
There is no rename option available for the Azure VM in the Azure portal at present and you cannot achieve this task either through any PowerShell or any other commands. Maybe Microsoft can think about this and provide a simplified option through the poral in future.
Vote for this feature: Ask Microsoft to add Rename Azure VM feature
Now sure about you but, I need this feature desperately for many of my clients. There is an open request for Rename Azure VM in the Microsoft Azure Feedback form with 1000+ vote and counting.
Unfortunately, there is no update current status update from Microsoft side. So, we have to wait till Microsoft provide this feature on their timeline.
There are 4 ways to rename Azure VM
- Delete the VM by keeping the Disk and recreate the VM with the NEW name
- Use anyone of the following blog, to rename Azure VM using PowerShell script (It will automatically delete the VM and create a new VM with the NEW name)
- Easiest option I prefer is Backup the VM and restore the VM with the New Name
- Stop the VM and Create managed disks snapshots, Create new managed disks from snapshots in the Resource Group and Deploy new VM using using managed disks in the Resource Group
Options 1 and 2 are complicated So, I prefer the 3rd or 4th easiest option. For 3rd option, please follow this step-by-step Instruction
Backup VMs documentation:
Restore VM documentation:
At the time of restoring VM make sure you select “Create New” option as shown in the image below and give the new VM name.
I hope this helps.