I understand you have an Ubuntu VM but have lost SSH connection and application access to services on the VM.
Since you are receiving a timeout, this likely means there is a network issue preventing access. To isolate if there is a network security group blocking the connection you can use the Network security group test from the portal.
- In the Azure portal, navigate to the VM that you want to test the connection to.
- In the VM's "Overview" page, click on "Connect" button.
- Click on "Test your connection" link.
- After the test completes it will alert you if there is a NSG blocking.
If there is not a NSG blocking the connection, you can use the "Troubleshoot SSH connectivity issues" link. This will let you know of any recent changes. You can select "Cannot Connect to VM" to be guided through steps to resolve the issue.
Hope this helps! If you the above doesn't resolve your issue please let me know and we can work with you directly to diagnose further.
Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.