Unable to connect VM using Bastion or RDP during Test Failover

Sijin N P 0 Reputation points
2025-10-31T14:04:04.8033333+00:00

Hi Team,

I have enabled the Azure Site Recovery and replicating it successfully. After the replication, i tried to do the Test Fail Over. But i am unable to connect the VM using Bastion or RDP. The error message says that NSG rule not allowing. But i did it properly.

Error message is following.

The target machine is unreachable. Please verify that your NSG rules allow traffic to ports 22 (SSH) and 3389 (RDP) from the private IP address

Thanks in advance.
Sijin NP
******@xtech.ae

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

1 answer

Sort by: Most helpful
  1. Suchitra Suregaunkar 3,545 Reputation points Microsoft External Staff Moderator
    2025-11-13T07:15:09.15+00:00

    Hello Sijin N P,

    You are unable to connect to the Test Failover VM using Bastion or RDP/SSH after performing a Test Failover in Azure Site Recovery (ASR). The error indicates NSG rules are blocking ports 22 or 3389, but you have already verified NSG settings. Later, you identified the source VM is Generation 2 (UEFI), while the Test Failover VM appears as Generation 1, causing boot and connectivity issues which might be due to below reasons:

    1. NSG/Bastion configuration – Bastion requires specific NSG rules to allow inbound traffic on TCP 3389 (RDP) or TCP 22 (SSH) from the Bastion subnet.
    2. Guest OS preparation – The VM must have RDP/SSH enabled and firewall rules configured before failover.
    3. Boot type mismatch – ASR supports UEFI/Gen2 for certain OS versions. If the target VM size or Compute & Network settings are incompatible, the VM may boot incorrectly and fail hydration.

    As a resolution please try below workarounds:
    Step 1: Validate NSG Rules for Bastion

    • On the Test Failover VM NIC:
      • Add Allow inbound rule for:
        • TCP 3389 (Windows) or TCP 22 (Linux)
        • Source: AzureBastionSubnet CIDR or VirtualNetwork
        • Priority: Higher than any deny rule
    • If there is a DenyAllOutbound rule, add an Allow outbound to VirtualNetwork for ports 3389/22.

    Reference: https://learn.microsoft.com/en-us/azure/bastion/bastion-nsg

    Step 2: Prepare Guest OS Before Failover:

    • Windows:
      • Enable RDP and allow TCP+UDP 3389 in all firewall profiles.
      • Remove persistent routes and WinHTTP proxy.
      • Set SAN policy to OnlineAll.
    • Linux:
      • Ensure SSH service starts on boot and firewall allows port 22.

    Reference: https://learn.microsoft.com/en-us/azure/site-recovery/site-recovery-failover

    Step 3: Address Generation 2 / UEFI Mismatch:

    Step 4: If RDP Still Fails:

    • Use VMAccess extension to reset RDP configuration:
      • Portal → VM → Reset password → Reset configuration only.

    If you have any other questions or need further support, please feel free to contact us.

    Thanks,

    Suchitra.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.