Attach a Data Disk to Another VM with Minimum Downtime
Short answer
C Detach the data disk first, since it can be hot-detached while both VMs remain online, minimizing offline time.
Question
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?
Key Takeaways
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.
Common mistake: 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.
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
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk
This link opens the official vendor documentation in a new tab.
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?
Can a data disk detached from one running VM be attached to another VM?
Discussion 250 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 30 of 250
-
EKTan 👍 35Correct. Just tested in lab. Didn't have to stop the VM the detach and attach to the other.
-
FunAJ 👍 27 Answered AStop the VM first so that disk data is not corrupted (if an service is writing data while you detach)
-
skydivex 👍 16Wrong... disk can be hot detached with powershell or through portal. the command ensures no operation is accessing the disk when detaching it. here is the link to micrsoft article: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk
-
klasbeatz 👍 14This makes the most sense but apparently stopping the VM isn't needed according to Microsoft documentation
-
imartinez 👍 13Right. the correct answer is C: detach the disk is the first action. And Also: You can only attach a data disk to a VM that is running- https://docs.microsoft.com/en-us/azure/devtest-labs/devtest-lab-attach-detach-data-disk
Show 25 more comments
-
jjnelo 👍 11Correct. Just tested in lab.
-
Benzitho 👍 9"You can hot remove a data disk using PowerShell, but make sure nothing is actively using the disk before detaching it from the VM." Copied from your LINK ....
-
FrostyD 👍 8Correct, tested in lab
-
KFM2020 👍 7Microsoft make a distinction between an OS disk and a data disk throughout their documentation and the portal. You will see this when you a view the disks blade for a VM. The top will show the attached OS disk and the bottom will show the data disks attached (if any). The offline reference is simply a trick or to see if you understand that you don't have to stop (offline) the VM first. Therefore, the answer to this question is C.
-
exampaul1 👍 7 Answered CThis exact question is on the Microsoft practice assessment for the AZ-104 exam and it states to detach the disk
-
JS_Jasey 👍 5The correct solution to minimize downtime while attaching the data disk to another Azure VM is: A. Stop the VM that includes the data disk. Explanation: Stopping the VM that includes the data disk will ensure that there are no active read/write operations on the disk while detaching it. Once the VM is stopped, you can safely detach the data disk from the VM. After detaching the data disk, you can then attach it to the target Azure VM. Finally, you can start both VMs (the one you detached the data disk from and the one you attached it to) to resume normal operations. By stopping the VM that includes the data disk first, you ensure that no data corruption or inconsistency occurs during the disk detachment process, and it allows for a smooth transition with minimal downtime for both VMs involved in the operation.
-
edutchieuk 👍 5 Answered CNot the best practice but the question is for the strategy to allow for the VM to be offline for the least amount of time possible. Stopping the VM = downtime whereby detaching the DATA disk only = no downtime. So anser C is the correct answer.
-
uwhm2b5fz 👍 5detaching the disk is the correct option to satisfy the requirement of least amount of time possible. You can verify no disk activity before doing so so stopping the VM is not the correct answer.
-
ServerBrain 👍 5Correct. surely if you can detach a USB drive from your Windows PC without shutting it down, how is it not possible to do the same on a VM..
-
Leti 👍 5 Answered CC is correct https://docs.microsoft.com/es-es/azure/virtual-machines/windows/detach-disk
-
Davidsv 👍 4 Answered CI made a experiment: 2 VM
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 -
tsummey 👍 4 Answered Cn Azure, every virtual machine (VM) has at least two types of disks: an operating system (OS) disk and one or more data disks. The OS disk is essential for booting the VM, while data disks are used for applications and data storage. When the question refers to a VM with a “single data disk,” it implies that there is one data disk in addition to the OS disk. Therefore, detaching the single data disk does not affect the VM’s ability to run because the OS disk remains attached, allowing the VM to operate normally. The data disk can be detached while the VM is running
-
mk_km 👍 4 Answered CDetach a data disk using the portal You can hot remove a data disk, but make sure nothing is actively using the disk before detaching it from the VM. In the left menu, select Virtual Machines. Select the virtual machine that has the data disk you want to detach. Under Settings, select Disks. In the Disks pane, to the far right of the data disk that you would like to detach, select the X button to detach. Select Save on the top of the page to save your changes. The disk stays in storage but is no longer attached to a virtual machine. The disk isn't deleted.
-
josephshy 👍 4 Answered AWhile a 'hot-detach' is possible, I would say its not preferable. The exam wording should probably align w the docs to prevent confusion. Do you want a smooth landing or wild ejector-seat ride? In a live environment, or specifically any organization's environment at scale, availability and data acuity are both important. Most often there is some internal process around this type of work and its content would err toward 'better safe than sorry' point of views.
-
francescoc 👍 4 Answered CWhen you no longer need a data disk that's attached to a virtual machine, you can easily detach it. This removes the disk from the virtual machine, but doesn't remove it from storage. When you detach the disk, make sure nothing is actively using the disk before detaching it from the VM. You can detach a disk using PowerShell. https://learn.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk
-
RajeshwaranM 👍 4 Answered CC is the correct option. I tried to detach the data disk from VM1 to VM2 without shutting down either of them. The only thing you need to consider is that while you detach the data disk, you need to ensure that the data disk is not being used by any service or operation.
-
AnonFox 👍 4 Answered CMicrosoft wants the answer based on "least amount of time required" "You can hot remove a data disk using PowerShell, but make sure nothing is actively using the disk before detaching it from the VM." No need to shut it down, even though in production you probably would.
-
oopspruu 👍 4 Answered CC is correct as we can simply detach a data disk, and then reattach it to a new or same VM. https://learn.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk The question doesn't say if there's any active data transfer on it or not so C is the right approach.
-
doodleman 👍 4 Answered CReference that is given in the solution even says that you detatch from a running machine: https://learn.microsoft.com/en-us/azure/devtest-labs/devtest-lab-attach-detach-data-disk#detach-a-data-disk
-
JunetGoyal 👍 4You can detach without stop vm , just make sure no active operation on disk, goto last section on doc!! https://learn.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk,
-
CTino 👍 4 Answered CThe correct answer should be C. You can "hot detach" a datadisk these days. See https://docs.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk
-
Sledgehammer 👍 4C is correct. I work with data disks on regualar bases and it is a blessing that this can be moved over to another VM without having to stop any VM first.
-
CaptHarlock 👍 4 Answered AA is correct!! The vm have a single disk!! That means is using same disk either OS and data. So you can't detached disk without shutting down vm.
-
ppp131176 👍 4I would say C is correct You can hot remove a data disk https://docs.microsoft.com/en-us/azure/virtual-machines/windows/detach-disk
-
theorut 👍 4VM has a single disk (so this will be an OS disk) and therefore VM needs to be stopped first. No detach available for OS disk.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All AZ-104 Questions
Access 100 questions with complete answers and detailed explanations.
View Full AZ-104 Practice Test →