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
Copy file name to clipboardExpand all lines: articles/stream-analytics/stream-analytics-quick-create-vs.md
+62-39Lines changed: 62 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,19 @@
1
1
---
2
-
title: Create a Stream Analytics job by using the Azure Stream Analytics tools for Visual Studio | Microsoft Docs
2
+
title: Create a Stream Analytics job by using the Azure Stream Analytics tools for Visual Studio
3
3
description: This quickstart shows you how to get started by creating a Stream Analytics job, configuring inputs, outputs, and defining a query with Visual Studio.
4
4
services: stream-analytics
5
5
author: mamccrea
6
6
ms.author: mamccrea
7
-
ms.date: 06/15/2018
7
+
ms.date: 12/20/2018
8
8
ms.topic: quickstart
9
9
ms.service: stream-analytics
10
10
ms.custom: mvc
11
-
manager: kfile
12
11
#Customer intent: "As an IT admin/developer I want to create a Stream Analytics job, configure input and output & analyze data by using Visual Studio."
13
12
---
14
13
15
14
# Quickstart: Create a Stream Analytics job by using the Azure Stream Analytics tools for Visual Studio
16
15
17
-
This quickstart shows you how to create and run a Stream Analytics job using Azure Stream Analytics tools for Visual Studio. The example job reads streaming data from Azure blob storage. The input data file used in this quickstart contains static data for illustrative purposes only. In a real world scenario, you use streaming input data for a Stream Analytics job. In this quickstart, you define a job that calculates the average temperature when over 100° and writes the resulting output events to a new file.
16
+
This quickstart shows you how to create and run a Stream Analytics job using Azure Stream Analytics tools for Visual Studio. The example job reads streaming data from an IoT Hub device. You define a job that calculates the average temperature when over 27° and writes the resulting output events to a new file in blob storage.
18
17
19
18
## Before you begin
20
19
@@ -28,33 +27,54 @@ This quickstart shows you how to create and run a Stream Analytics job using Azu
28
27
29
28
## Prepare the input data
30
29
31
-
Before defining the Stream Analytics job, you should prepare the data, which is configured as input to the job. To prepare the input data required by the job, run the following steps:
30
+
Before defining the Stream Analytics job, you should prepare the data, which is later configured as the job input. To prepare the input data required by the job, complete the following steps:
32
31
33
-
1.Download the [sample sensor data](https://raw.githubusercontent.com/Azure/azure-stream-analytics/master/Samples/GettingStarted/HelloWorldASA-InputStream.json) from GitHub. The sample data contains sensor information in the following JSON format:
32
+
1.Sign in to the [Azure portal](https://portal.azure.com/).
34
33
35
-
```json
36
-
{
37
-
"time": "2018-01-26T21:18:52.0000000",
38
-
"dspl": "sensorC",
39
-
"temp": 87,
40
-
"hmdt": 44
41
-
}
42
-
```
43
-
2. Sign in to the [Azure portal](https://portal.azure.com/).
34
+
2. Select **Create a resource** > **Internet of Things** > **IoT Hub**.
35
+
36
+
3. In the **IoT Hub** pane, enter the following information:
37
+
38
+
|**Setting**|**Suggested value**|**Description**|
39
+
|---------|---------|---------|
40
+
|Subscription |\<Your subscription\>| Select the Azure subscription that you want to use. |
41
+
|Resource group | asaquickstart-resourcegroup | Select **Create New** and enter a new resource-group name for your account. |
42
+
|Region |\<Select the region that is closest to your users\>| Select a geographic location where you can host your IoT Hub. Use the location that's closest to your users. |
43
+
|IoT Hub Name | MyASAIoTHub | Select a name for your IoT Hub. |
44
+
45
+

46
+
47
+
4. Select **Next: Set size and scale**.
48
+
49
+
5. Choose your **Pricing and scale tier**. For this quickstart, select the **F1 - Free** tier if it's still available on your subscription. If the free tier is unavailable, choose the lowest tier available. For more information, see [IoT Hub pricing](https://azure.microsoft.com/pricing/details/iot-hub/).
50
+
51
+

52
+
53
+
6. Select **Review + create**. Review your IoT Hub information and click **Create**. Your IoT Hub might take a few minutes to create. You can monitor the progress in the **Notifications** pane.
54
+
55
+
7. In your IoT Hub navigation menu, click **Add** under **IoT devices**. Add a **Device ID** and click **Save**.
56
+
57
+

44
58
45
-
3. From the upper left-hand corner of the Azure portal, select**Create a resource**> **Storage** > **Storage account**. Fill out the Storage account job page with **Name** set to "asaquickstartstorage", **Location** set to "West US", **Resource group** set to "asaquickstart-resourcegroup" (host the storage account in the same resource group as the Streaming job for increased performance). The remaining settings can be left to their default values.
59
+
8. Once the device is created, open the device from the**IoT devices**list. Copy the **Connection string -- primary key** and save it to a notepad to use later.
4. From **All resources** page, find the storage account you created in the previous step. Open the **Overview** page, and then the **Blobs** tile.
63
+
## Create blob storage
50
64
51
-
5. From the **Blob Service** page, select **Container**, provide a **Name** for your container, such as *container1* > select **OK**.
65
+
1. From the upper left-hand corner of the Azure portal, select **Create a resource** > **Storage** > **Storage account**.
52
66
53
-

67
+
2. In the **Create storage account** pane, enter a storage account name, location, and resource group. Choose the same location and resource group as the IoT Hub you created. Then click **Review + create** to create the account.
54
68
55
-
6. Go to the container you created in the previous step. Select **Upload** and upload the sensor data that you got from the first step.
4. From the **Blob Service** page, select **Container** and provide a name for your container, such as *container1*. Leave the **Public access level** as **Private (no anonymous access)** and select **OK**.
@@ -89,11 +109,10 @@ Notice the elements that are included in an Azure Stream Analytics project.
89
109
|---------|---------|---------|
90
110
|Input Alias | Input | Enter a name to identify the job’s input. |
91
111
|Source Type | Data Stream | Choose the appropriate input source: Data Stream or Reference Data. |
92
-
|Source |Blob Storage| Choose the appropriate input source. |
112
+
|Source |IoT Hub| Choose the appropriate input source. |
93
113
|Resource | Choose data source from current account | Choose to enter data manually or select an existing account. |
94
-
|Subscription |\<Your subscription\>| Select the Azure subscription that has the storage account you created. The storage account can be in the same or in a different subscription. This example assumes that you have created storage account in the same subscription. |
95
-
|Storage Account | asaquickstartstorage | Choose or enter the name of the storage account. Storage account names are automatically detected if they are created in the same subscription. |
96
-
|Container | container1 | Select the existing container that you created in your storage account. |
114
+
|Subscription |\<Your subscription\>| Select the Azure subscription that has the IoT Hub you created. |
115
+
|IoT Hub | MyASAIoTHub | Choose or enter the name of your IoT Hub. IoT Hub names are automatically detected if they are created in the same subscription. |
97
116
98
117
3. Leave other options to default values and select **Save** to save the settings.
99
118
@@ -126,16 +145,10 @@ Notice the elements that are included in an Azure Stream Analytics project.
126
145
2. Add the following query:
127
146
128
147
```sql
129
-
SELECT
130
-
System.TimestampAS OutputTime,
131
-
dspl AS SensorName,
132
-
Avg(temp) AS AvgTemperature
133
-
INTO
134
-
Output
135
-
FROM
136
-
Input TIMESTAMP BY time
137
-
GROUP BY TumblingWindow(second,30),dspl
138
-
HAVINGAvg(temp)>100
148
+
SELECT*
149
+
INTO BlobOutput
150
+
FROM IoTHubInput
151
+
HAVING Temperature >27
139
152
```
140
153
141
154
## Submit a Stream Analytics query to Azure
@@ -146,13 +159,23 @@ Notice the elements that are included in an Azure Stream Analytics project.
146
159
147
160

148
161
162
+
## Run the IoT simulator
163
+
164
+
1. Open the [Raspberry Pi Azure IoT Online Simulator](https://azure-samples.github.io/raspberry-pi-web-simulator/) in a new browser tab or window.
165
+
166
+
2. Replace the placeholder in Line 15 with the Azure IoT Hub device connection string you saved in a previous section.
167
+
168
+
3. Click **Run**. The output should show the sensor data and messages that are being sent to your IoT Hub.
169
+
170
+

171
+
149
172
## Start the Stream Analytics job and check output
150
173
151
174
1. When your job is created, the job view opens automatically. Select the green arrow button to start the job,
@@ -176,7 +199,7 @@ When no longer needed, delete the resource group, the streaming job, and all rel
176
199
177
200
In this quickstart, you deployed a simple Stream Analytics job using Visual Studio. You can also deploy Stream Analytics jobs using the [Azure portal](stream-analytics-quick-create-portal.md) and [PowerShell](stream-analytics-quick-create-powershell.md).
178
201
179
-
To learn about configuring other input sources and performing real-time detection, continue to the following article:
202
+
To learn about Azure Stream Analytics tools for Visual Studio, continue to the following article:
180
203
181
204
> [!div class="nextstepaction"]
182
-
> [Real-time fraud detection using Azure Stream Analytics](stream-analytics-real-time-fraud-detection.md)
205
+
> [Use Visual Studio to view Azure Stream Analytics jobs](stream-analytics-vs-tools.md)
0 commit comments