In this comprehensive guide, we will walk you through the process of connecting to Azure Machine Learning (ML) compute instances using Secure Shell (SSH) within Visual Studio Code (VSCode). This method can be a more convenient alternative to using the Azure portal or other tools.
Prerequisites
Before we begin, ensure that you have the following prerequisites in place:
- An Azure ML workspace.
- An Azure ML compute cluster.
- Visual Studio Code installed on your local machine.
- The Azure ML Tools extension for Visual Studio Code installed.
- An SSH key pair generated and added to your Azure ML workspace.
Configuring VSCode for SSH Connection
Before you can connect to your Azure ML compute instances via SSH, you need to configure VSCode for SSH:
Step 1: Install OpenSSH
OpenSSH is a suite of secure networking utilities based on the OpenBSD Secure Shell (SSH) project. It is required for SSH connections from VSCode:
# For Windows users:
powershell Install-Package OpenSSH-Win64
Step 2: Configure SSH Key in VSCode
Configure your SSH key in VSCode:
1. Open User Settings (File > Preferences > Settings or Ctrl+,):
2. Add the following JSON snippet:
{
"ssh.privateKeyPath": "/path/to/your/ssh/key"
}
Connecting to Azure ML Compute Instances via SSH
Now that you have configured VSCode for SSH, you can connect to your Azure ML compute instances:
Step 1: Open Integrated Terminal
Open the Integrated Terminal within VSCode:
View > Terminal
Step 2: Connect to Azure ML Compute Instance
Use the following command to connect to your Azure ML compute instance:
az ml compute ssh
Troubleshooting
If you encounter any issues during the SSH connection process, refer to the following resources:
In this article, we have covered the process of connecting to Azure ML compute instances via SSH within Visual Studio Code. This method offers a more convenient alternative to using the Azure portal or other tools for managing your compute instances. Remember that you need to have the Azure ML Tools extension installed, and your SSH key added to your Azure ML workspace.