How To Force Azure Replication To Stop From Orphaned Hyper-V VM

There is a scenario when you are using Azure Site Recovery and a VM somehow becomes orphanened, no longer controlled by ASR, but you cannot remove replication from the VM on the host. I had that situation this morning with a WS2012 R2 Hyper-V VM (no VMM present).

The situation leaves you in a position where you cannot disable replication on the VM using either the UI or PowerShell, because the host continues to believe that replication is managed by Azure, even if you remove the provider (agent) from the host or remove the host from ASR. In PowerShell, you get the error:

Operation not allowed because the virtual machine ‘<name>’ is replicating to a provider other than Hyper-V”

Failed ASR Removal

Microsoft has guidance on how to clear this problem up for Hyper-V to Azure and VMM to Azure replication, which I found by accident after a difficult 30 minutes! The key for me to the solution was to run a small 4 line script that removes replication using WMI, found under the heading “Clean up protection settings manually (between Hyper-V sites and Azure)”. I copied that script into ISE (running with elevated admin rights) and replication was disabled for the VM.

One thought on “How To Force Azure Replication To Stop From Orphaned Hyper-V VM”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.