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
Select Ctrl+Shift+P to open the command palette, and then enter ADL: Download Local Run Package to download the packages.
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
2.1 To install BuildTools, select visualcppbuildtools_full.exe in the LocalRunDependency folder, then follow the wizard instructions.
2.2 To install Win10SDK 10240, select sdksetup.exe in the LocalRunDependency/Win10SDK_10.0.10240_2 folder, then follow the wizard instructions.
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.
Select Ctrl+Shift+P to open the command palette, and then enter ADL: Start Local Run Service.
Select Accept to accept the Microsoft Software License Terms for the first time.
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.
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.
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.
Start a local debug for the U-SQL job
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.
- Install .NET Core SDK 2.0 as suggested in the message box, if not installed.
- Install C# for Visual Studio Code as suggested in the message box if not installed. Select Install to continue, and then restart VS Code.
Follow steps below to perform local debug:
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.
Set a breakpoint in your C# code-behind.
Back to script editor, right-click and select ADL: Local Debug.
Next steps
- Use the Azure Data Lake Tools for Visual Studio Code
- Develop U-SQL with Python, R, and C# for Azure Data Lake Analytics in VS Code
- Get started with Data Lake Analytics using PowerShell
- Get started with Data Lake Analytics using the Azure portal
- Use Data Lake Tools for Visual Studio for developing U-SQL applications
- Use Data Lake Analytics(U-SQL) catalog