How to Rename an Azure SQL VM and Managed Disks without Affecting SQL Server?

Abimbola Adeniran 66 Reputation points
2025-01-02T09:34:52.93+00:00

We have a SQL Server Azure Virtual Machine (Win/SQL 2022) that was deployed using a marketplace image and is currently running. This VM was set up as part of a SQL Server Migration project from on-premises to the cloud, where some databases have already been migrated and managed disks spun up. The client has just changed the requirement to say they want the VM and managed disks renamed to conform with their naming convention.

I know Azure VM resources cannot be renamed (immutable). What is the best way to resolve this, with minimal impact on the SQL Server running on this VM (databases, managed disks, etc.) ?

SQL Server on Azure Virtual Machines
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,286 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,379 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 116.6K Reputation points MVP
    2025-01-02T10:02:44.66+00:00

    Hi @Abimbola Adeniran ,

    make sure you have a working backup of your Azure VM (full backup) before you start!

    Rename OS Disk:

    • Shutdown the VM
    • Create a Snapshot of the OS Disk
    • Create a new OS Disk from this Snapshot (choose the name of the new disk as you like)
    • Swap the OS Disk in VM
    • Start the VM and do your testing

    Rename Data Disks:

    • Shutdown the VM
    • Create a Snapshot of each Data Disk
    • Create a new Disk from each Snapshot (choose the name of the new disk as you like)
    • Detach old Data Disk(s)
    • Attach new Data Disk(s)
    • Start the VM and do your testing

    If everything is working fine you can delete the old OS Disk and the Data Disk(s)

    Rename VM:

    • Shutdown the VM
    • Delete the VM but don't delete the disks!
    • Navigate to the existing OS disk in the Azure Portal
    • Click on Create VM and follow the steps to create a new VM based on the existing OS Disk
    • Attach the Data Disk(s) the the new created VM
    • Start the VM and do your testing

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.