Share via


Run U-SQL and debug locally in Visual Studio Code

Important

Azure Data Lake Analytics retired on 29 February 2024. Learn more with this announcement.

For data analytics, your organization can use Azure Synapse Analytics or Microsoft Fabric.

This article describes how to run U-SQL jobs on a local development machine to speed up early coding phases or to debug code locally in Visual Studio Code. For instructions on Azure Data Lake Tool for Visual Studio Code, see Use Azure Data Lake Tools for Visual Studio Code.

Only Windows installations of the Azure Data Lake Tools for Visual Studio support the action to run U-SQL locally and debug U-SQL locally. Installations on macOS and Linux-based operating systems don't support this feature.

Set up the U-SQL local run environment

  1. Select Ctrl+Shift+P to open the command palette, and then enter ADL: Download Local Run Package to download the packages.

    Download the ADL LocalRun Dependency packages

  2. Locate the dependency packages from the path shown in the Output pane, and then install BuildTools and Win10SDK 10240. Here's an example path:
    C:\Users\xxx\AppData\Roaming\LocalRunDependency

    Locate the dependency packages

    2.1 To install BuildTools, select visualcppbuildtools_full.exe in the LocalRunDependency folder, then follow the wizard instructions.

    Install BuildTools

    2.2 To install Win10SDK 10240, select sdksetup.exe in the LocalRunDependency/Win10SDK_10.0.10240_2 folder, then follow the wizard instructions.

    Install Win10SDK 10240

  3. Set up the environment variable. Set the SCOPE_CPP_SDK environment variable to:
    C:\Users\XXX\AppData\Roaming\LocalRunDependency\CppSDK_3rdparty

Start the local run service and submit the U-SQL job to a local account

For the first-time user, use ADL: Download Local Run Package to download local run packages, if you have not set up U-SQL local run environment.

  1. Select Ctrl+Shift+P to open the command palette, and then enter ADL: Start Local Run Service.

  2. Select Accept to accept the Microsoft Software License Terms for the first time.

    Accept the Microsoft Software License Terms

  3. The cmd console opens. For first-time users, you need to enter 3, and then locate the local folder path for your data input and output. If you're unsuccessful defining the path with backslashes, try forward slashes. For other options, you can use the default values.

    Data Lake Tools for Visual Studio Code local run cmd

  4. Select Ctrl+Shift+P to open the command palette, enter ADL: Submit Job, and then select Local to submit the job to your local account.

    Data Lake Tools for Visual Studio Code select local

  5. After you submit the job, you can view the submission details. To view the submission details, select jobUrl in the Output window. You can also view the job submission status from the cmd console. Enter 7 in the cmd console if you want to know more job details.

    Data Lake Tools for Visual Studio Code local run output Data Lake Tools for Visual Studio Code local run cmd status

Start a local debug for the U-SQL job

For the first-time user:

  1. Use ADL: Download Local Run Package to download local run packages, if you have not set up U-SQL local run environment.
  2. Install .NET Core SDK 2.0 as suggested in the message box, if not installed.   reminder installs Dotnet
  3. Install C# for Visual Studio Code as suggested in the message box if not installed. Select Install to continue, and then restart VS Code.

Reminder to install C#

Follow steps below to perform local debug:

  1. Select Ctrl+Shift+P to open the command palette, and then enter ADL: Start Local Run Service. The cmd console opens. Make sure that the DataRoot is set.

  2. Set a breakpoint in your C# code-behind.

  3. Back to script editor, right-click and select ADL: Local Debug.

    Data Lake Tools for Visual Studio Code local debug result

Next steps