not able to connect to azure vm

Fen Yang 0 Reputation points
2025-12-18T09:15:23.3933333+00:00

Having issue to connect to an azure vm, please help to provide details on the troubleshooting steps

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
{count} votes

2 answers

Sort by: Most helpful
  1. Himanshu Shekhar 2,090 Reputation points Microsoft External Staff Moderator
    2025-12-18T09:22:53.1866667+00:00

    Hey @Fen Yang, I understand you’re having trouble connecting to your Azure VM. Here’s a rundown of some troubleshooting steps that might help you resolve the issue:

    1. Check VM Status: First, make sure your VM is running. You can do this through the Azure portal or by using Azure PowerShell with the command:
         Get-AzureRmVm -Status
      
      Network Security Group (NSG) Rules: Ensure that the NSG associated with your VM’s network interface allows the necessary inbound traffic. For SSH (Linux VMs), confirm that TCP port 22 is open, and for RDP (Windows VMs), confirm that TCP port 3389 is open.
    2. Connection Method:
      • For Linux VMs: Use this command to connect via SSH: ssh -l <username> <ip address>
      • For Windows VMs: Open a Remote Desktop application and connect using the VM's public IP address.
      Restart the VM: If you’re facing connectivity issues, try restarting the VM from the Azure portal to resolve any transient issues.
    3. Use Serial Console: If you’re still unable to connect, utilize the Serial Console to access the VM directly:
      • Check the network interface configuration using: netsh interface show interface
      • If it's disabled, enable it with:netsh interface set interface name="<interface name>" admin=enabled
    4. Boot Diagnostics: Enable and view Boot Diagnostics in the Azure portal to check the startup status of the VM and identify any potential issues. Diagnose with Azure Network Watcher: Use tools like IP Flow Verify and Next Hop to identify whether the traffic is getting blocked at any point.
    5. Reset Credentials: If you suspect an authentication issue, you can reset your VM's password for Windows or SSH keys for Linux VMs. Check Local Firewalls: Ensure that your local machine’s firewall settings aren’t blocking outbound connections to your VM.

    Here are some helpful links for further assistance:

    Hope this helps you get connected! If you have any more specifics or if this doesn't resolve your issue, feel free to ask.

    0 comments No comments

  2. Ankit Yadav 7,945 Reputation points Microsoft External Staff Moderator
    2025-12-22T16:26:52.2966667+00:00

    Hey Fen Yang, The VM is failing to boot the guest OS and is stuck at the Hyper‑V splash screen, so this is an OS‑level boot/driver problem blocking your RDP operation with the VM.

     

    Likely root causes

    Quick mitigations to try:

    • Stop (deallocate) and then start the VM instead of only rebooting, and see if the screenshot in boot diagnostics change.
    • Try a different compatible VM size and start it again; in some recent incidents, a resize alone has brought VMs stuck at the Hyper‑V logo back to normal.​

    If these don't help, try checking and repairing disk/system files using Serial Console.

     

    • Connect via the Serial Console (under Support + Troubleshooting in portal).
    • Use command prompt and login to the VM.  
    • Then run below commands one by one:
        chkdsk /f 
      
      //above command is used to check disk integrity
        sfc /scannow
      
      //above command is used to repair system files

    If issue is still there, try repair path using Repair VM:-

    • Use Azure VM repair (portal or az vm repair) to automatically:
      • Create a rescue VM,
      • Detach the broken OS disk, attach it to the rescue VM, and mount it for offline repair.​
    • On the rescue VM, perform offline fixes on the attached OS disk, for example:
      • Remove or roll back recent problematic updates (uninstall from the offline Windows image).
      • Check and repair file system and boot files using tools like chkdsk and sfc against the offline Windows folder.​

    References:

    If repair also fails:-

    • Restore the VM from a recent backup or snapshot, which is the fastest way to recover if the OS disk is badly corrupted or repeated repair attempts fail.​
    • As a last resort, create a new VM and swap in the data disks from the faulty VM so user data is preserved even if the OS disk must be discarded.

    Reference:​


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.