Attach a Data Disk to Another VM with Minimum Downtime
You have an Azure virtual machine (VM) that has a single data disk. You have been tasked with attaching this data disk to another Azure VM. You need to make sure that your strategy allows for the virtual machines to be offline for the least amount of time possible. Which of the following is the action you should take FIRST?
Community Insight
Azure supports hot-detaching a data disk while the source VM keeps running, so the tested knowledge is that no shutdown step is required before moving the disk.
When moving a data disk between Azure VMs, the fastest path is a hot detach: removing the disk from its current VM does not require powering off either machine, so both stay online. The correct first action is to detach the data disk, then attach it to the target VM.
Many learners choose A, believing the source VM must be stopped first to prevent data corruption; Microsoft documentation explicitly supports detaching a data disk from a running VM.
Community Discussion (263 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option C is the first step because a data disk can be hot-detached from a running Azure VM directly through the portal, CLI, or PowerShell without deallocating the machine. Microsoft's detach-disk documentation confirms you can remove a data disk while the VM is running, provided no application is actively writing to it, and the same disk can then be attached to a second VM. Choosing C first minimizes downtime because neither the source nor the target VM ever needs to be stopped during the transfer.Why the Other Options Are Wrong
Option A (stop the source VM) adds unnecessary downtime — the community lab tests confirm the detach works without a shutdown, so stopping the VM directly conflicts with the "least amount of time offline" requirement. Option B (stop the target VM) is likewise unnecessary; the target VM only needs to be running to accept the disk attachment, and stopping it would only extend the outage. Option D (delete the source VM) is destructive and irreversible — it would remove the VM and its configuration entirely rather than simply moving the disk.Community Comment Notes
jecawi9630's comment states plainly: "You can simply detach a data disk from one VM and attach it to the other VM without stopping either of the VMs," and several lab testers (EKTan, jjnelo, FrostyD) confirm they completed the operation with both VMs running. exampaul1 adds that "This exact question is on the Microsoft practice assessment for the AZ-104 exam and it states to detach the disk." The dissenting view from FunAJ ("Stop the VM first so that disk data is not corrupted") reflects a real concern about active writes, but as Benzitho and skydivex note, that is handled by verifying nothing is using the disk rather than by powering off the VM.Official Reference
Exam Strategy
Remember the distinction between hot and cold operations: data disks support hot attach and hot detach, while OS disks and VM deletion always require a stop. In any "least downtime" question, pick the action that avoids stopping or deallocating a VM.
Frequently Asked Questions
Does the source VM need to be stopped before detaching a data disk?
No. Azure supports hot-detaching a data disk from a running VM as long as no application is actively writing to it, so stopping the VM is unnecessary.
Can a data disk detached from one running VM be attached to another VM?
Yes. Once detached, the disk can be attached to another VM, which should be running to accept the attachment.
Related Analysis
Practice All AZ-104 Questions
Access 100 questions with complete answers and detailed explanations.
View Full AZ-104 Practice Test →
s in one region in 2 zones (zone 1 and zone 2). And i can say thats you dont need to turn off virtual machine at all! Create a disk in 1 VM, attach. Now you can see that you can attach Disk on VM when its on. Deattach and you gonna see thats you dont need to turn off VM to do it. Make snapshot of disk, after that do a new disk that gonna take data from snapshot and make it in 2 zone (or in zone 1 if you deattach from VM in zone 2). After creating go to VM2 disk and attach a new disk. You can do it without turning off VM2. And thats a miracle! Disk2 has been attached! So answer C is complitely correct. If you don`t trust my try it by yourself and you will see