Unable to delete Physical machine in Azure Site Recovery

Le Vinh Dat 5 Reputation points
2025-01-02T09:29:48.8533333+00:00

Hi All,

I'm trying to replicate a VMware with iSCSI disk to Azure Site Recovery.

Because it has iSCSI disk, So I try to replicate as Physical machine.

The first time is OK. However, in the mid-way, I "disable replication" in order to make some change.

Then I'm unable to choose and start the replication again.

It says "Machine is already protected by Azure Site Recovery".

Where can I see and delete the orphaned machine?

Thanks a lot.

User's image

Azure Site Recovery
Azure Site Recovery
An Azure native disaster recovery service. Previously known as Microsoft Azure Hyper-V Recovery Manager.
745 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 48,256 Reputation points Microsoft Employee
    2025-01-03T10:16:28.8133333+00:00

    @Le Vinh Dat Thanks for sharing the script.

    Summarizing from the discussion (above). @Le Vinh Dat, Thanks for sharing the info/solution with the community.

    Issue: Unable to delete Physical machine in Azure Site Recovery

    Error: Machine is already protected by Azure Site Recovery

    Solution: Resolved by Azure support "Need to run some PowerShell scripts to update properties of the servers in Azure physical site."

    Steps to be followed:
    Go to your VM, Follow below steps:

    1. ArmClient has to be pre-installed. (https://github.com/projectkudu/ARMClient/releases )
    2. Open the PowerShell window. Run the login command.

    ARMClient.exe login

    1. Get the recovery services fabric details using below commands. Replace the subscription and vault details.

    .\ARMClient.exe get /Subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.RecoveryServices/vaults/<vaultName>/replicationFabrics?api-version=2021-06-01

    1. Pick the physicalSiteId from the above results. To get the site details, machine details and machine list run the below commands. 

    .\ARMClient.exe get "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>?api-version=2020-09-09-preview"

    .\ARMClient.exe get "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>/machines?api-version=2020-09-09-preview"

    1. Get the Physical site Id and machine Id from the above commands output. And run below script to remove the protected tag on that machine:

    $armId = "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>"

    $apiInput = @{}

     $tags = New-Object System.Collections.Generic.Dictionary"[String,String]"

     $machines = New-Object System.Collections.ArrayList

     $machine = @{}

    $machine['machineArmId'] = "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>/machines/<machineId>"

    $machine['tags'] = $tags

     $machines.Add($machine)

     $apiInput['machines'] = $machines

     $armCmd = $armId + "/UpdateProperties?api-version=2020-09-09-preview"

     $apiInput | ConvertTo-Json -Depth 5 | armclient.exe post $armCmd -verbose

    Then go back and see your server is available for replication again.Go to your VM, Follow below steps:

    1. ArmClient has to be pre-installed. (https://github.com/projectkudu/ARMClient/releases )
    2. Open the PowerShell window. Run the login command.

    ARMClient.exe login

    1. Get the recovery services fabric details using below commands. Replace the subscription and vault details.

    .\ARMClient.exe get /Subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.RecoveryServices/vaults/<vaultName>/replicationFabrics?api-version=2021-06-01

    1. Pick the physicalSiteId from the above results. To get the site details, machine details and machine list run the below commands. 

    .\ARMClient.exe get "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>?api-version=2020-09-09-preview"

    .\ARMClient.exe get "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>/machines?api-version=2020-09-09-preview"

    1. Get the Physical site Id and machine Id from the above commands output. And run below script to remove the protected tag on that machine:

    $armId = "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>"

    $apiInput = @{}

     $tags = New-Object System.Collections.Generic.Dictionary"[String,String]"

     $machines = New-Object System.Collections.ArrayList

     $machine = @{}

    $machine['machineArmId'] = "/subscriptions/<subscritionId>/resourceGroups/<rgName>/providers/Microsoft.OffAzure/ServerSites/<physicalsite>/machines/<machineId>"

    $machine['tags'] = $tags

     $machines.Add($machine)

     $apiInput['machines'] = $machines

     $armCmd = $armId + "/UpdateProperties?api-version=2020-09-09-preview"

     $apiInput | ConvertTo-Json -Depth 5 | armclient.exe post $armCmd -verbose

    Then go back and see your server is available for replication again.

    Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer. They can only accept answers by others, I' have summarized and posted the solution/answer to benefit the community users to find the answers quickly.


    If the response helped, do "Accept Answer" and up-vote it

    0 comments No comments

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.