Open In App

How to use Azure Stream Analytics for stream processing

Azure Stream Analytics is a managed stream processing engine for real-time data analysis from various sources, like devices and applications. It identifies patterns and triggers actions, making it useful for alerts, reporting, and data storage. It can run on Azure IoT Edge for processing data on IoT devices.

Where to use Azure Stream Analytics?

What are the benefits of Azure Stream Analytics?

In this article, we perform the following steps to demonstrate how to use Azure Stream Analytics for processing data stream (here from an IoT device)

Steps to use Azure Stream Analytics for Stream Processing

Step 1: Creating an IoT Hub.





Step 2: Setting up an IoT device.

Step 3: Setting up Stream Analytics Job.

Step 4: Creating an Azure Blob Storage for output.

Step 5: Connecting Steam from loT to BLOB with query.

Adding an Input.

Adding an Output.

Define the SQL Query




SELECT
    *
INTO
    bloboutput
FROM
    iotinput

Step 6: Starting the Job.

Step 7: Visualizing the Data.

Creating New Output to Power BI.

Adding a New Query.




SELECT
    AVG(temperature) as temperature
INTO
    powerbioutput
FROM
    iotinput
GROUP BY
    TumblingWindow(second, 2)

Start the Job

Visualize Data using Power BI

Note: You can add any number of Tiles with various Visualization Types.

Visualization of Data

Basic Troubleshooting

  1. What if the secure connection test fails during input setup?
    Delete the input and attempt to add it again.
  2. Unable to Receive Data from the Input Stream? Error Indicates Deserialization Problem.
    Potential Causes:
    • Malformed events: The incoming data may have issues or be improperly formatted.
    • Incorrect serialization format configuration for the input source.
      Solutions:
    • Test the incoming data connection. Click on three dots present on right side of your desired input. Click on Test.
    • Check the serialization format in the Output blade under Stream Analytics Job.
  3. Receiving the Message ‘You Haven’t Configured Diagnostic Settings for This Job Yet’ when starting the Job.
    You can either disregard the message or set up diagnostic settings in the dedicated pane.
  4. The ‘Add Output’ button appears to be inactive when attempting to create a new output.
    You can’t add a new output while the job is already running. Go to Overview and then click on Stop to stop the running job.
  5. I can’t find my dataset in PowerBi under the datasets tab.
    • Visit the Raspberry Pi Web Simulator to check if the data is still being sent as input to Azure Portal.
    • Run the query to see if the output stream is working properly.

Frequently Asked Questions on How to use Azure Stream Analytics for stream processing

1. Should The Format of Data for Output and Input be Same?

Data formats for input and output in a pipeline can be different based on your needs.For example, in data processing pipelines, it’s common to:Ingest data in one format (e.g., JSON, CSV, Avro) and transform it into a different format for processing.

2. Can I Add Multiple Queries?

Yes, you are allowed to use multiple queries. These multiple queries can use multiple inputs and multiple outputs.

3. What is an Input Alias, and Why is it Important?

An Input Alias is a name for your data source, which you’ll use in your Stream Analytics job. It helps you identify and manage different input sources in your query.

4. How do I Visualize the Processed Data in Real-time?

You can use Power BI to create a real-time dashboard for visualizing the data.


Article Tags :