Connect to an Azure Machine Learning compute instance in Visual Studio Code (preview)

In this article, you'll learn how to connect to an Azure Machine Learning compute instance using Visual Studio Code.

An Azure Machine Learning compute instance is a fully managed cloud-based workstation for data scientists and provides management and enterprise readiness capabilities for IT administrators.

There are two ways you can connect to a compute instance from Visual Studio Code:

  • Remote compute instance. This option provides you with a full-featured development environment for building your machine learning projects.
  • Remote Jupyter Notebook server. This option allows you to set a compute instance as a remote Jupyter Notebook server.


This feature is currently in public preview. This preview version is provided without a service-level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Configure a remote compute instance

To configure a remote compute instance for development, you'll need a few prerequisites.


To connect to a compute instance behind a firewall, see Configure inbound and outbound network traffic.

To connect to your remote compute instance:

Navigate to


In order to connect to your remote compute instance from Visual Studio Code, make sure that the account you're logged into in Azure Machine Learning studio is the same one you use in Visual Studio Code.


  1. Select the Compute tab
  2. In the Application URI column, select VS Code for the compute instance you want to connect to.

Connect to Compute Instance VS Code Azure Machine Learning studio


  1. Select the Notebook tab
  2. In the Notebook tab, select the file you want to edit.
  3. Select Editors > Edit in VS Code (preview).

Connect to Compute Instance VS Code Azure Machine Learning Notebook

A new window launches for your remote compute instance. When attempting to make a connection to a remote compute instance, the following tasks are taking place:

  1. Authorization. Some checks are performed to make sure the user attempting to make a connection is authorized to use the compute instance.
  2. VS Code Remote Server is installed on the compute instance.
  3. A WebSocket connection is established for real-time interaction.

Once the connection is established, it's persisted. A token is issued at the start of the session which gets refreshed automatically to maintain the connection with your compute instance.

After you connect to your remote compute instance, use the editor to:

Configure compute instance as remote notebook server

In order to configure a compute instance as a remote Jupyter Notebook server you'll need a few prerequisites:

To connect to a compute instance:

  1. Open a Jupyter Notebook in Visual Studio Code.

  2. When the integrated notebook experience loads, select Jupyter Server.

    Launch Azure Machine Learning remote Jupyter Notebook server dropdown

    Alternatively, you also use the command palette:

    1. Open the command palette by selecting View > Command Palette from the menu bar.
    2. Enter into the text box AzureML: Connect to Compute instance Jupyter server.
  3. Choose Azure Machine Learning Compute Instances from the list of Jupyter server options.

  4. Select your subscription from the list of subscriptions. If you have have previously configured your default Azure Machine Learning workspace, this step is skipped.

  5. Select your workspace.

  6. Select your compute instance from the list. If you don't have one, select Create new Azure Machine Learning Compute Instance and follow the prompts to create one.

  7. For the changes to take effect, you have to reload Visual Studio Code.

  8. Open a Jupyter Notebook and run a cell.


You MUST run a cell in order to establish the connection.

At this point, you can continue to run cells in your Jupyter Notebook.


You can also work with Python script files (.py) containing Jupyter-like code cells. For more information, see the Visual Studio Code Python interactive documentation.

Next steps

Now that you've set up Visual Studio Code Remote, you can use a compute instance as remote compute from Visual Studio Code to interactively debug your code.

Tutorial: Train your first ML model shows how to use a compute instance with an integrated notebook.