Hi @Mishra, Suryakant,
Welcome to Microsoft Q&A Forum, thank you for posting your query here!
Yes, this is expected behavior in Azure when restoring a VM using the "Restore as new VM" option. The hostname (computer name) inside the VM remains as it was configured in the original VM because Azure's backup and restoration process creates a new VM by cloning the original VM's disk. The hostname is part of the OS configuration, which is stored in the VM's disk image, and Azure does not automatically update it during restoration.
This behavior contrasts with some other backup tools that modify the hostname as part of the restoration process.
Why does this happen?
- Azure Backup Design: The backup primarily works at the disk level, not the OS configuration level.
- OS-Level Changes Are Not Made: Azure does not modify the contents of the VM's operating system during the restore process, preserving the original hostname and configurations.
How to Resolve This?
If the mismatch between the VM name and hostname is an issue, you can manually update the hostname inside the VM after the restoration.
Steps to Update Hostname:
Windows VM:
- Log in to the VM.
- Go to System Properties > Computer Name > Change.
- Enter the new desired hostname (e.g., wxyz1234).
- Restart the VM for the changes to take effect.
- Linux VM:
- SSH into the VM.
- Enter the new desired hostname (e.g., wxyz1234).
- Go to System Properties > Computer Name > Change.
- Update the hostname using the following commands:
sudo hostnamectl set-hostname wxyz1234
Edit the /etc/hosts
and /etc/hostname
files (if applicable) to ensure the new hostname persists across reboots.
let us know if any help, we will always help as you needed.!
Please do not forget to "Accept the answer” wherever the information provided helps you, this can be beneficial to other community members.