Reputation: 2159
I have 1 x OS disk and 1 x Data disk attached to VM1, the disks are unmanaged in storage account mystorage
So I know I cannot rename the storage account...
Can I instead do the following then somehow re-attach them to the Original VM again?
The only thing im not sure on how to do is re-attach them to the VM1
Upvotes: 0
Views: 2808
Reputation: 25
Your process is right so far.
Stop the VM
Detach disks from VM1
Break lease and copy disks like you indicated.
Reattach disks to VM1: Once the disks are copied to the new storage account, navigate to VM1 in the Azure portal. Select "Disks" from the settings menu. Click on "Attach existing" at the top. Choose the disk, specify the disk name, and confirm the action.
Start VM1: After reattaching the disks, start VM1.
Upvotes: 0
Reputation: 1
You could create a snapshot of the OS disk, move the snapshot to the new storage account and create the VM , that way you would keep the OS disk.
Upvotes: 0
Reputation: 72191
yeah, this is a valid approach, you dont need to break the lease if you deallocate the vm (at least that is my impression).
you can use az cli to attach unmanaged disk (https://learn.microsoft.com/en-us/cli/azure/vm/unmanaged-disk?view=azure-cli-latest#az-vm-unmanaged-disk-attach) or portal ui (https://cloud.netapp.com/blog/azure-virtual-machines-attach-mount) or powershell
Upvotes: 0