Test Stream Analytics queries locally against live stream input by using Visual Studio Code
You can use Azure Stream Analytics Tools for Visual Studio Code to test your Stream Analytics jobs locally against live stream input. The input can come from a source like Azure Event Hubs or Azure IoT Hub. The output results are sent as JSON files to a folder in your project called LocalRunOutputs.
Install the .NET Core SDK and restart Visual Studio Code.
Use this quickstart to learn how to create a Stream Analytics job by using Visual Studio Code.
Define a live stream input
Right-click the Inputs folder in your Stream Analytics project. Then select ASA: Add Input from the context menu.
You can also select Ctrl+Shift+P to open the command palette and enter ASA: Add Input.
Choose an input source type from the drop-down list.
If you added the input from the command palette, choose the Stream Analytics query script that will use the input. It should be automatically populated with the file path to myASAproj.asaql.
Choose Select from your Azure Subscriptions from the drop-down menu.
Configure the newly generated JSON file. You can use the CodeLens feature to help you enter a string, select from a drop-down list, or change the text directly in the file. The following screenshot shows Select from your Subscriptions as an example.
To make sure that the input data is coming, select Preview data in your live input configuration file from the top line. Some input data comes from an IoT hub and is shown in the preview window. The preview might take a few seconds to appear.
Run queries locally
Return to your query editor, and select Run locally. Then select Use Live Input from the drop-down list.
The result is shown in the right window and refreshed every 3 seconds. You can select Run to test again. You can also select Open in folder to see the result files in File Explorer and open them with Visual Studio Code or a tool like Excel. Note that the result files are available only in JSON format.
The default time for the job to start creating output is set to Now. You can customize the time by selecting the Output start time button in the result window.