You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Process data from Event Hubs Azure using Stream Analytics | Microsoft Docs
3
3
description: This article shows you how to process data from your Azure event hub using an Azure Stream Analytics job.
4
-
ms.date: 03/14/2022
5
-
ms.topic: article
4
+
ms.date: 05/22/2023
5
+
ms.topic: how-to
6
6
---
7
7
8
8
9
9
# Process data from your event hub using Azure Stream Analytics
10
-
The Azure Stream Analytics service makes it easy to ingest, process, and analyze streaming data from Azure Event Hubs, enabling powerful insights to drive real-time actions. This integration allows you to quickly create a hot-path analytics pipeline. You can use the Azure portal to visualize incoming data and write a Stream Analytics query. Once your query is ready, you can move it into production in only a few clicks.
10
+
The Azure Stream Analytics service makes it easy to ingest, process, and analyze streaming data from Azure Event Hubs, enabling powerful insights to drive real-time actions. You can use the Azure portal to visualize incoming data and write a Stream Analytics query. Once your query is ready, you can move it into production in only a few clicks.
11
11
12
12
## Key benefits
13
13
Here are the key benefits of Azure Event Hubs and Azure Stream Analytics integration:
14
+
14
15
-**Preview data** – You can preview incoming data from an event hub in the Azure portal.
15
16
-**Test your query** – Prepare a transformation query and test it directly in the Azure portal. For the query language syntax, see [Stream Analytics Query Language](/stream-analytics-query/built-in-functions-azure-stream-analytics) documentation.
16
17
-**Deploy your query to production** – You can deploy the query into production by creating and starting an Azure Stream Analytics job.
@@ -22,70 +23,85 @@ Here are the key benefits of Azure Event Hubs and Azure Stream Analytics integra
22
23
23
24
1. Sign in to the [Azure portal](https://portal.azure.com).
24
25
1. Navigate to your **Event Hubs namespace** and then navigate to the **event hub**, which has the incoming data.
25
-
1. Select **Process Data** on the event hub page.
26
+
1. Select **Process Data** on the event hub page or select **Process data** on the left menu.
26
27
27
-

28
-
1. Select **Explore** on the **Enable real-time insights from events** tile.
28
+
:::image type="content" source="./media/process-data-azure-stream-analytics/process-data-tile.png" alt-text="Screenshot showing the Process data page for the event hub." lightbox="./media/process-data-azure-stream-analytics/process-data-tile.png":::
29
+
1. Select **Start** on the **Enable real-time insights from events** tile.
:::image type="content" source="./media/process-data-azure-stream-analytics/process-data-page-explore-stream-analytics.png" alt-text="Screenshot showing the Process data page with Enable real time insights from events tile selected." lightbox="./media/process-data-azure-stream-analytics/process-data-page-explore-stream-analytics.png":::
31
32
1. You see a query page with values already set for the following fields:
32
33
1. Your **event hub** as an input for the query.
33
34
1. Sample **SQL query** with SELECT statement.
34
35
1. An **output** alias to refer to your query test results.
:::image type="content" source="./media/process-data-azure-stream-analytics/query-editor.png" alt-text="Screenshot showing the Query editor for your Stream Analytics query." lightbox="./media/process-data-azure-stream-analytics/query-editor.png":::
37
38
38
39
> [!NOTE]
39
40
> When you use this feature for the first time, this page asks for your permission to create a consumer group and a policy for your event hub to preview incoming data.
40
41
1. Select **Create** in the **Input preview** pane as shown in the preceding image.
41
-
1. You'll immediately see a snapshot of the latest incoming data in this tab.
42
+
1. You immediately see a snapshot of the latest incoming data in this tab.
42
43
- The serialization type in your data is automatically detected (JSON/CSV). You can manually change it as well to JSON/CSV/AVRO.
43
44
- You can preview incoming data in the table format or raw format.
44
45
- If your data shown isn't current, select **Refresh** to see the latest events.
45
46
46
-
Here is an example of data in the **table format**:
47
-

47
+
Here's an example of data in the **table format**:
48
48
49
-
Here is an example of data in the **raw format**:
49
+
:::image type="content" source="./media/process-data-azure-stream-analytics/snapshot-results.png" alt-text="Screenshot of the Input preview window in the result pane of the Process data page in a table format." lightbox="./media/process-data-azure-stream-analytics/snapshot-results.png":::
50
50
51
-

51
+
Here's an example of data in the **raw format**:
52
+
53
+
:::image type="content" source="./media/process-data-azure-stream-analytics/snapshot-results-raw-format.png" alt-text="Screenshot of the Input preview window in the result pane of the Process data page in the raw format." lightbox="./media/process-data-azure-stream-analytics/snapshot-results-raw-format.png":::
52
54
1. Select **Test query** to see the snapshot of test results of your query in the **Test results** tab. You can also download the results.
:::image type="content" source="./media/process-data-azure-stream-analytics/test-results.png" alt-text="Screenshot of the Input preview window in the result pane with test results." lightbox="./media/process-data-azure-stream-analytics/test-results.png":::
55
57
1. Write your own query to transform the data. See [Stream Analytics Query Language reference](/stream-analytics-query/stream-analytics-query-language-reference).
56
-
1. Once you've tested the query and you want to move it in to production, select **Deploy query**. To deploy the query, create an Azure Stream Analytics job where you can set an output for your job, and start the job. To create a Stream Analytics job, specify a name for the job, and select **Create**.
57
-
58
-

59
-
60
-
> [!NOTE]
61
-
> We recommend that you create a consumer group and a policy for each new Azure Stream Analytics job that you create from the Event Hubs page. Consumer groups allow only five concurrent readers, so providing a dedicated consumer group for each job will avoid any errors that might arise from exceeding that limit. A dedicated policy allows you to rotate your key or revoke permissions without impacting other resources.
58
+
1. Once you've tested the query and you want to move it in to production, select **Create Stream Analytics job**.
59
+
60
+
:::image type="content" source="./media/process-data-azure-stream-analytics/create-job-link.png" alt-text="Screenshot of the Query page with the Create Stream Analytics job link selected.":::
61
+
1. On the **New Stream Analytics job** page, follow these steps:
62
+
1. Specify a **name** for the job.
63
+
1. Select your **Azure subscription** where you want the job to be created.
64
+
1. Select the **resource group** for the Stream Analytics job resource.
65
+
1. Select the **location** for the job.
66
+
1. For the **Event Hubs policy name**, create a new policy or select an existing one.
67
+
1. For the **Event Hubs consumer group**, create a new consumer group or select an existing consumer group.
68
+
1. Select **Create** to create the Stream Analytics job.
69
+
70
+
:::image type="content" source="./media/process-data-azure-stream-analytics/create-stream-analytics-job.png" alt-text="Screenshot showing the New Stream Analytics job window.":::
71
+
72
+
> [!NOTE]
73
+
> We recommend that you create a consumer group and a policy for each new Azure Stream Analytics job that you create from the Event Hubs page. Consumer groups allow only five concurrent readers, so providing a dedicated consumer group for each job will avoid any errors that might arise from exceeding that limit. A dedicated policy allows you to rotate your key or revoke permissions without impacting other resources.
62
74
1. Your Stream Analytics job is now created where your query is the same that you tested, and input is your event hub.
63
75
64
-
9. To complete the pipeline, set the **output** of the query, and select **Start** to start the job.
76
+
:::image type="content" source="./media/process-data-azure-stream-analytics/add-output-link.png" alt-text="Screenshot showing the Stream Analytics job page with a link to add an output.":::
77
+
9. Add an [output](../stream-analytics/stream-analytics-define-outputs.md) of your choice.
78
+
1. Navigate back to Stream Analytics job page by clicking the name of the job in breadcrumb link.
79
+
1. Select **Edit query** above the **Query** window.
80
+
1. Update `[OutputAlias]` with your output name, and select **Save query** link above the query. Close the Query page by selecting X in the top-right corner.
81
+
1. Now, on the Stream Analytics job page, select **Start** on the toolbar to start the job.
65
82
66
-
> [!NOTE]
67
-
> Before starting the job, don't forget to replace the outputalias by the output name you created in Azure Stream Analytics.
68
-
69
-

83
+
:::image type="content" source="./media/process-data-azure-stream-analytics/set-output-start-job.png" alt-text="Screenshot of the Start job window for a Stream Analytics job.":::
70
84
71
85
72
86
## Access
73
-
Issue : User cannot access Preview data because they don’t have right permissions on the Subscription.
87
+
**Issue** : User can't access preview data because they don’t have right permissions on the Subscription.
74
88
75
89
Option 1: The user who wants to preview incoming data needs to be added as a Contributor on Subscription.
76
90
77
91
Option 2: The user needs to be added as Stream Analytics Query tester role on Subscription. Navigate to Access control for the subscription. Add a new role assignment for the user as "Stream Analytics Query Tester" role.
78
92
79
-
Option 3: The user can create Azure Stream Analytics job. Set input as this Event Hub and navigate to "Query" to preview incoming data from this Event Hub.
93
+
Option 3: The user can create Azure Stream Analytics job. Set input as this event hub and navigate to "Query" to preview incoming data from this event hub.
80
94
81
95
Option 4: The admin can create a custom role on the subscription. Add the following permissions to the custom role and then add user to the new custom role.
82
-

Your Azure Stream Analytics job defaults to three streaming units (SUs). To adjust this setting, select **Scale** on the left menu in the **Stream Analytics job** page in the Azure portal. To learn more about streaming units, see [Understand and adjust Streaming Units](../stream-analytics/stream-analytics-streaming-unit-consumption.md).
:::image type="content" source="./media/process-data-azure-stream-analytics/scale.png" alt-text="Screenshots showing the Scale page for a Stream Analytics job." lightbox="./media/process-data-azure-stream-analytics/scale.png":::
89
105
90
106
## Next steps
91
107
To learn more about Stream Analytics queries, see [Stream Analytics Query Language](/stream-analytics-query/built-in-functions-azure-stream-analytics)
0 commit comments