Thank you for reaching out to the Microsoft Q&A platform.
Based on your question description we understand that you are facing an issue while connecting to azure VM using Visual Studio via SSH.
Here are some steps you can take to troubleshoot and resolve this issue:
Please check the VS Code Configuration with the Remote-SSH extension in VS Code connections configuration.
Make sure you have the latest Azure SDK installed and ensure that your Visual Studio is updated to the latest version.
If you have access to the VM through the Azure Serial Console, check the SSH service status with below command.
sudo systemctl status sshd
If the SSH service is not running, start it:
sudo systemctl start sshd
Please check the Firewall Settings on the VM that are not blocking any SSH connections.
Please find the below similar issue articles for you reference:
https://stackoverflow.com/questions/64034813/vs-code-remote-ssh-connection-not-working
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Thanks.