Rediger

Del via


Test Stream Analytics queries locally with Visual Studio

You can use Azure Stream Analytics tools for Visual Studio to test your Stream Analytics jobs locally with sample data or live data.

Use this Quickstart to learn how to create a Stream Analytics job using Visual Studio.

Test your query

In your Azure Stream Analytics project, double-click Script.asaql to open the script in the editor. You can compile the query to see if there are any syntax errors. The query editor supports IntelliSense, syntax coloring, and an error marker.

Query editor

Add local input

To validate your query against local static data, right-click the input and select Add local input.

Screenshot that highlights the Add local input menu option.

In the pop-up window, select sample data from your local path and Save.

Add local input

A file named local_EntryStream.json is added automatically to your inputs folder.

Local input folder file list

Select Run Locally in the query editor. Or you can press F5.

Run Locally

The output can be viewed in a table format directly from Visual Studio.

Output in table format

You can find the output path from the console output. Press any key to open the result folder.

Local run

Check the results in the local folder.

Local folder result

Sample input

You can also collect sample input data from your input sources to a local file. Right-click the input configuration file, and select Sample Data.

Sample Data

You can only sample data streaming from Event Hubs or IoT Hubs. Other input sources are not supported. In the pop-up dialog box, fill in the local path to save the sample data and select Sample.

Sample data configuration

You can see the progress in the Output window.

Sample data output

Next steps