An Azure service that is used to provision Windows and Linux virtual machines.
The symptoms point to a guest or VM health issue, not just a Bastion authentication problem:
- Treat the VM as potentially unhealthy first Since Run command is not returning useful output, check whether the VM agent is healthy. In the Azure portal, go to Virtual Machines > affected VM > Settings > Properties and verify Agent Status is Ready. If the agent is not healthy, guest-side diagnostics and Bastion sessions can both fail.
- Check boot state from the platform side
In the Azure portal, open Virtual Machines > affected VM > Help > Boot diagnostics.
- Review the Screenshot to confirm the OS is actually booted and not stuck.
- Review the Serial log for boot or kernel errors. This helps distinguish a networking problem from an OS or host problem.
- Use Bastion Connection Troubleshoot
In the Azure portal, open the Azure Bastion resource, then go to Help > Connection Troubleshoot.
Run a TCP check to the VM.
- If the path is reachable, the issue is likely inside the guest OS: SSH service, SSH port listening state, firewall, disk-full condition, or Entra sign-in configuration.
- If the path is not reachable, investigate NSGs, routing, or Bastion-to-VM connectivity.
- Validate the SSH service and port on the VM
For Linux VMs, the documented checks are:
- SSH daemon must be active.
- Port 22 must be listening, unless SSH was intentionally moved to a custom port.
-
iptablesorfirewalldmust not be blocking SSH. - OS disk usage must not be full. If diagnostics show the SSH daemon is inactive, port 22 is not listening, firewall rules block SSH, or disk usage is at 100%, Bastion SSH sessions can fail even when the tunnel initially opens.
- Check whether Microsoft Entra login on the VM is still valid
For
--auth-type AAD, the target VM must have Microsoft Entra login enabled with the correct VM extension:-
AADSSHLoginForLinuxfor Linux If the extension is stuck in Transitioning, documented causes include: - missing system-assigned managed identity
- older AADLoginForLinux extension still installed Also verify the user still has either Virtual Machine Administrator Login or Virtual Machine User Login at the VM scope. Without that role assignment, sign-in can fail after Azure authentication succeeds.
-
- Confirm Bastion prerequisites for native client + AAD
For
az network bastion ssh:- Bastion must be Standard SKU or higher
- Native Client support (tunneling) must be enabled on the Bastion host
- Local Azure CLI must have both the bastion and ssh extensions installed If these prerequisites were missing, the command would normally fail earlier, but they should still be verified.
- If the VM appears unhealthy, use recovery actions carefully
If Boot diagnostics or Serial log suggests the guest is hung or not booting correctly:
- Try Restart first.
- If still failing, use Redeploy + reapply to move the VM to a fresh Azure host while preserving disks.
- Before any risky recovery work, create snapshots of the OS disk and any data disks.
- Most likely interpretation for this specific pattern
Because:
- the Entra SSH certificate is generated,
- the Bastion tunnel initially connects,
- then the connection is reset,
- and Run command is also not responding,
- VM agent health
- Boot diagnostics / Serial log
- Bastion Connection Troubleshoot
- guest SSH daemon / port / firewall / disk state
-
AADSSHLoginForLinuxextension health and managed identity
If all guest health checks look normal and the VM remains reachable but Bastion SSH still resets, the documented next step is to file an Azure support request.
References:
- Troubleshoot Azure Bastion session failures due to unhealthy target VMs
- Troubleshoot Azure Bastion connection failures caused by blocked ports
- Troubleshoot Azure Bastion problems
- Sign in to a Linux virtual machine in Azure by using Microsoft Entra ID and OpenSSH
- SSH to Azure VM suddenly stopped working, VM is healthy and NSGs allow traffic - Microsoft Q&A