Can't connect Linux VM

Karying Tam 0 Reputation points
2026-08-14T02:39:11+00:00

Hi,

My Linux VM can't be accessed in power on status.

Tried Support suggestions as below but still can't work.

Root Cause Analysis Summary: The VM xxx is currently in a stopped and deallocated state. This power status indicates that the VM is effectively powered off and thus not accessible for connections.

Recommendation:

  1. Start the VM xxx either from the Azure portal or using the following Azure CLI command:
az vm start --resource-group xxx --name xxx --subscription 1af6208f-1da0-4a6a-8d92-795ab6536 

Azure CLI command (Manual)

You can copy and run the following Azure CLI command(s) in the cloud shell:

az account set --subscription 1af6208f-1da0-4a6a-8d92-795ab6536 az vm start --resource-group xxx --name xxx --subscription 1af6208f-1da0-4a6a-8d92-795ab6536
Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.


1 answer

Sort by: Most helpful
  1. AI answer

    2026-08-14T02:39:28+00:00

    If the VM is still not accessible, verify the actual power state first, then use the next recovery actions based on that result.

    1. Check the VM power state in Azure CLI:
    az vm get-instance-view \
      --name <vm-name> \
      --resource-group <resource-group> \
      --query instanceView.statuses[1] --output table
    

    Expected result:

    • VM running means the guest OS has started from the hypervisor perspective.
    • VM stopped still incurs compute charges.
    • VM deallocated does not incur compute charges and cannot accept connections.
    1. If the VM is Deallocated or Stopped, start it:
    az vm start -g <resource-group> -n <vm-name>
    

    Then wait 1–2 minutes and check the power state again. Azure Bastion guidance requires the VM to be in the Running power state before it can accept connections.

    1. If the VM shows Running but SSH still fails, restart the VM to clear underlying compute issues:
    az vm restart --resource-group <resource-group> --name <vm-name>
    

    Portal path:

    • VM > Restart
    1. If restart does not help, redeploy the VM to a new Azure host:
    az vm redeploy --resource-group <resource-group> --name <vm-name>
    

    Portal path:

    • VM > Help > Redeploy

    Warning:

    • Redeploy can cause loss of ephemeral disk data.
    • Dynamic public IP addresses associated with the VM are updated.
    1. If the VM is stuck in Failed state in the portal, run reapply:
    az vm reapply -g <resource-group> -n <vm-name>
    

    Portal path:

    • VM > Support + troubleshooting > Redeploy + reapply > Reapply
    1. If the VM is Running but Linux is still unreachable, check whether SSH permissions or ownership are broken. If the Azure Linux VM Agent is Ready, use:
    • VM > Operations > Run Command > RunShellScript

    For Ubuntu:

    #!/bin/bash
    mkdir -p /var/run/sshd;chmod 755 /var/run/sshd;chown root:root /var/run/sshd
    

    For RHEL:

    #!/bin/bash
    mkdir -p /var/empty/sshd;chmod 755 /var/empty/sshd;chown root:root /var/empty/sshd
    

    For SUSE:

    #!/bin/bash
    mkdir -p /var/lib/empty;chmod 755 /var/lib/empty;chown root:root /var/lib/empty
    

    If the VM Agent is not ready, use the Serial Console instead and run the same OS-specific commands there.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

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.