Skip to content

Commit 1475baf

Browse files
committed
ASA Freshness, Acrolynx, Learn Linter
1 parent 4f3e3ea commit 1475baf

File tree

7 files changed

+48
-85
lines changed

7 files changed

+48
-85
lines changed
13.4 KB
Loading
67.2 KB
Loading
32.7 KB
Loading
31.6 KB
Loading

articles/stream-analytics/quick-create-visual-studio-code.md

Lines changed: 39 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
title: Quickstart - Create a Stream Analytics job using Visual Studio Code
2+
title: Create a Stream Analytics job using Visual Studio Code
33
description: This quickstart shows you how to create a Stream Analytics job using the ASA extension for Visual Studio Code.
44
ms.service: azure-stream-analytics
55
author: ahartoon
66
ms.author: anboisve
7-
ms.date: 07/17/2023
7+
ms.date: 12/17/2024
88
ms.topic: quickstart
99
ms.custom: mvc, mode-ui
1010
#Customer intent: As an IT admin/developer, I want to create a Stream Analytics job, configure input and output, and analyze data by using Visual Studio Code.
1111
---
1212

1313
# Quickstart: Create a Stream Analytics job using Visual Studio Code
14-
15-
This quickstart shows you how to create, run and submit an Azure Stream Analytics (ASA) job using the ASA Tools extension for Visual Studio Code in your local machine. You learn to build an ASA job that reads real-time streaming data from IoT Hub and filters events with a temperature greater than 27°. The output results are sent to a file in blob storage. The input data used in this quickstart is generated by a Raspberry Pi online simulator.
14+
In this quickstart, you create, run and submit an Azure Stream Analytics (ASA) job using the ASA Tools extension for Visual Studio Code in your local machine. You learn to build an ASA job that reads real-time streaming data from IoT Hub and filters events with a temperature greater than 27°. The output results are sent to a file in blob storage. The input data used in this quickstart is generated by a Raspberry Pi online simulator.
1615

1716
> [!NOTE]
1817
> Visual Studio Code tools don't support jobs in the China East, China North, Germany Central, and Germany NorthEast regions.
@@ -37,50 +36,16 @@ This quickstart shows you how to create, run and submit an Azure Stream Analytic
3736
> [!NOTE]
3837
> The ASA Tools extension will automatically sign you in every time you open VS Code. If your account has two-factor authentication, we recommend that you use phone authentication rather than using a PIN. To sign out your Azure account, press `Ctrl + Shift + P` and enter `Azure: Sign Out`.
3938
40-
## Prepare the input data
41-
42-
Before defining the Stream Analytics job, you should prepare the input data. The real-time sensor data is ingested to IoT Hub, which later configured as the job input. To prepare the input data required by the job, follow these steps:
43-
44-
1. Sign in to the [Azure portal](https://portal.azure.com/).
45-
2. Select **Create a resource > Internet of Things > IoT Hub**.
46-
47-
:::image type="content" source="./media/quick-create-visual-studio-code/create-resource-iot-hub-menu.png" alt-text="Screenshot showing the Create Resource page for Iot Hub.":::
48-
49-
3. On the **IoT Hub** page, enter the following information:
50-
* **Subscription**, select your Azure subscription.
51-
* **Resource group**, select an existing resource group or create a new resource group.
52-
* **IoT hub name**, enter a name for your IoT hub.
53-
* **Region**, select the region that's closest to you.
54-
55-
:::image type="content" source="./media/quick-create-visual-studio-code/create-iot-hub.png" alt-text="Screenshot showing the IoT Hub page for creation.":::
56-
57-
4. Go to **Management** page, for **Pricing and scale tier**, select **F1: Free tier**, if it's still available on your subscription. For more information, see [Azure IoT Hub pricing](https://azure.microsoft.com/pricing/details/iot-hub/).
58-
59-
:::image type="content" source="./media/quick-create-visual-studio-code/iot-management-page.png" alt-text="Screenshot showing the IoT Hub management page.":::
60-
61-
5. Select **Review + create**. Review your IoT hub information and select **Create**. This process may take a few minutes to deploy your IoT hub.
62-
63-
6. After your IoT hub is created, select **Go to resource** to navigate to the **IoT Hub** page. '
64-
65-
7. On the **IoT Hub** page, select **Devices** on the left menu, and then select **\+ Add Device**.
66-
67-
:::image type="content" source="./media/quick-create-visual-studio-code/add-device-menu.png" alt-text="Screenshot showing the Add Device button on the Devices page.":::
68-
9. Enter a **Device ID** and select **Save**.
69-
70-
:::image type="content" source="./media/quick-create-visual-studio-code/add-device-iot-hub.png" alt-text="Screenshot showing the Add Device page.":::
71-
10. Once the device is created, you should see the device from the **IoT devices** list. Select **Refresh** button on the page if you don't see it.
72-
73-
:::image type="content" source="./media/quick-create-visual-studio-code/select-device.png" alt-text="Screenshot showing the selection of the device on the Devices page.":::
74-
11. Select your device from the list. Copy **Primary Connection String** and save it to a notepad to use later.
39+
## Run the IoT simulator
7540

76-
:::image type="content" source="./media/quick-create-visual-studio-code/save-iot-device-connection-string.png" alt-text="Screenshot showing the primary connection string of the device you created.":::
41+
1. Open the [Raspberry Pi Azure IoT Online Simulator](https://azure-samples.github.io/raspberry-pi-web-simulator/).
42+
2. Replace the placeholder in Line 15 with the Azure IoT Hub device connection string you saved in a previous section.
43+
3. Select **Run**. The output should show the sensor data and messages that are being sent to your IoT Hub.
7744

78-
## Run the IoT simulator
79-
1. Open the [Raspberry Pi Azure IoT Online Simulator](https://azure-samples.github.io/raspberry-pi-web-simulator/) in a new browser tab.
80-
2. Replace the placeholder in line 15 with the IoT hub device connection string that you saved earlier.
81-
3. Select **Run**. The output should show the sensor data and messages that are being sent to your IoT hub.
45+
:::image type="content" source="./media/stream-analytics-quick-create-portal/ras-pi-connection-string.png" lightbox="./media/stream-analytics-quick-create-portal/ras-pi-connection-string.png" alt-text="Screenshot showing the **Raspberry Pi Azure IoT Online Simulator** page with the sample query.":::
8246

83-
:::image type="content" source="./media/quick-create-visual-studio-code/ras-pi-connection-string.png" lightbox="./media/quick-create-visual-studio-code/ras-pi-connection-string.png" alt-text="Screenshot showing the Raspberry Pi Azure IoT Online Simulator with output.":::
47+
> [!IMPORTANT]
48+
> Select **Reset** after a few minutes to reset the connection string.
8449
8550
## Create blob storage
8651

@@ -106,11 +71,11 @@ Before defining the Stream Analytics job, you should prepare the input data. The
10671

10772
:::image type="content" source="./media/quick-create-visual-studio-code/create-new-project.png" alt-text="Screenshot showing the selection of ASA: Create New Project in the command palette.":::
10873

109-
2. Enter your project name, like **myASAproj**, and select a folder for your project.
74+
1. Enter your project name, like **myASAproj**, and select a folder for your project.
11075

11176
:::image type="content" source="./media/quick-create-visual-studio-code/create-project-name.png" alt-text="Screenshot showing entering an ASA project name.":::
11277

113-
3. An ASA project is added to your workspace. It consists of three folders: **Inputs**, **Outputs**, and **Functions**. It also has the query script **(*.asaql)**, a **JobConfig.json** file, and an **asaproj.json** configuration file.
78+
1. An ASA project is added to your workspace. It consists of three folders: **Inputs**, **Outputs**, and **Functions**. It also has the query script **(*.asaql)**, a **JobConfig.json** file, and an **asaproj.json** configuration file.
11479

11580
:::image type="content" source="./media/quick-create-visual-studio-code/asa-project-files.png" alt-text="Screenshot showing Stream Analytics project files in Visual Studio Code.":::
11681

@@ -139,22 +104,21 @@ Before defining the Stream Analytics job, you should prepare the input data. The
139104
:::image type="content" source="./media/quick-create-visual-studio-code/add-input-from-inputs-folder.png" lightbox="./media/quick-create-visual-studio-code/add-input-from-inputs-folder.png" alt-text="Screenshot showing the ASA: Add input menu in Visual Studio Code.":::
140105

141106
Or press **Ctrl+Shift+P** to open the command palette and enter **ASA: Add Input**.
142-
143107
2. Choose **IoT Hub** for the input type.
144108

145109
:::image type="content" source="./media/quick-create-visual-studio-code/iot-hub.png" lightbox="./media/quick-create-visual-studio-code/iot-hub.png" alt-text="Screenshot showing the selection of your IoT hub in VS Code command palette.":::
110+
3. Choose **Select from Azure subscriptions** from the drop-down menu, and then press **ENTER**.
111+
1. Enter **Input** for the name, and then press **ENTER**.
112+
1. Under **Inputs** folder, you see an **IoTHub1.json** file is created.
113+
1. In the JSON file, confirm that **Input** is specified **Name**.
114+
1. In the JSON editor for **Input.json**, choose **Select from your subscriptions**, and then select your Azure subscription that has the IoT hub.
146115

147-
3. Select an ASA script **\*.asaql** and **Azure Subscriptions** from the drop-down menu, and then press **ENTER**.
148-
149-
4. Under **Inputs** folder, you see an **IoTHub1.json** file is created. Replace settings with following suggested values and keep default values for fields not mentioned here.
116+
:::image type="content" source="./media/quick-create-visual-studio-code/select-from-your-azure-subscriptions.png" lightbox="./media/quick-create-visual-studio-code/select-from-your-azure-subscriptions.png" alt-text="Screenshot showing the JSON editor with Select from your subscriptions link.":::
117+
1. In the JSON editor, choose **Select an IoT Hub**, and then select the IoT hub you created.
150118

151-
|Setting|Suggested Value|Description|
152-
|-------|---------------|-----------|
153-
|Name|**Input**|This input name is used for **FROM** statement in the query.|
154-
|IotHubNamespace|**spiothub** |Name of your IoT hub. The IoT hub names are automatically detected if you **Select from your subscription**.|
155-
|SharedAccessPolicyName|**iothubowner**||
156-
157-
:::image type="content" source="./media/quick-create-visual-studio-code/iothub-configuration.png" lightbox="./media/quick-create-visual-studio-code/iothub-configuration.png" alt-text="Screenshot showing the IoT Hub configuration in VS Code.":::
119+
:::image type="content" source="./media/quick-create-visual-studio-code/select-iot-hub-json.png" lightbox="./media/quick-create-visual-studio-code/select-iot-hub-json.png" alt-text="Screenshot showing the JSON editor with Select an IoT Hub link.":::
120+
1. By default, the `SharedAccessPolicyName` should be set to `iothubowner`. If not, choose **Select a Shared Access Policy Name** link, and then select **iothubowner** from the drop-down list.
121+
1. The `SharedAccessPolicyKey` value should be automatically set.
158122

159123
<!-- 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. The credentials are auto-listed and saved in local credential manager.
160124
@@ -172,17 +136,13 @@ Before defining the Stream Analytics job, you should prepare the input data. The
172136

173137
## Configure job output
174138

175-
1. Press **Ctrl+Shift+P** to open the command palette and enter **ASA: Add Output**.
176-
2. Choose **Data Lake Storage Gen2/Blob Storage** for the sink type.
177-
3. Select the query script using this output.
178-
4. Enter **BlobStorage1** as output file name.
179-
5. Edit the settings using the following values. Keep default values for fields not mentioned here.
180-
181-
|Setting|Suggested value|Description|
182-
|-------|---------------|-----------|
183-
|Name| **Output** | This output name is used for **INTO** statement in the query.|
184-
|Storage Account| **spstorageaccount0901** |Choose or enter the name of your storage account. Storage account names are automatically detected if they're created in the same subscription.|
185-
|Container|**spcontainer**|Select the existing container that you created in your storage account.|
139+
1. Right-click **Outputs** in the explorer, and select **ASA: Add Output**.
140+
2. Choose **Data Lake Storage Gen2/Blob Storage** for the sink type in the drop-down list.
141+
1. Choose **Select from Azure subscriptions**
142+
1. Enter **Output** for the name of the alias and press ENTER. This output name is used for **INTO** statement in the query.
143+
1. In the JSON editor for **Output.json**, choose **Select from your subscriptions**, and then select your Azure subscription that has the Azure Storage account
144+
1. If you need to change the storage account that's automatically filled, choose **Select a Storage account**, and then select your Azure Storage account. Storage account names are automatically detected if they're created in the same subscription.
145+
1. If you need to change the container name, choose **Select a container**, and select the blob container you created.
186146

187147
<!-- |Path Pattern|output|Enter the name of a file path to be created within the container.| -->
188148

@@ -194,30 +154,32 @@ Before defining the Stream Analytics job, you should prepare the input data. The
194154

195155
Script compilation checks syntax and generates the Azure Resource Manager templates for automatic deployment.
196156

197-
1. Right-click the script and select **ASA: Compile Script**.
157+
1. Right-click the script file in the explorer window, point to **ASA: Compile Script**, and then select **ASA: ARM Template V2 (recommended)**.
198158

199159
:::image type="content" source="./media/quick-create-visual-studio-code/compile-script-2.png" lightbox="./media/quick-create-visual-studio-code/compile-script-2.png" alt-text="Screenshot showing the compilation of script option from the Stream Analytics explorer in VS Code.":::
200-
201160
2. After compilation, you see a **Deploy** folder under your project with two Azure Resource Manager templates. These two files are used for automatic deployment.
202161

203162
:::image type="content" source="./media/quick-create-visual-studio-code/deployment-templates.png" lightbox="./media/quick-create-visual-studio-code/deployment-templates.png" alt-text="Screenshot showing the generated deployment templates in the project folder.":::
204-
205163
3. Select **Submit to Azure** in the query editor.
206164

207-
:::image type="content" source="./media/quick-create-visual-studio-code/submit-job.png" lightbox="./media/quick-create-visual-studio-code/submit-job.png" alt-text="Screenshot showing the submit job button to submit the Stream Analytics job to Azure.":::
208-
209-
Then follow the instructions to complete the process: **Select subscription > Select a job > Create New Job > Enter job name > Choose resource group and region.**
165+
:::image type="content" source="./media/quick-create-visual-studio-code/submit-job.png" lightbox="./media/quick-create-visual-studio-code/submit-job.png" alt-text="Screenshot showing the Submit job button to submit the Stream Analytics job to Azure.":::
166+
3. In the **Submit** window, follow these steps:
167+
1. Select your Azure **subscription**.
168+
1. Select an Azure **resource group**.
169+
1. Select the **region** where you want to create the Stream Analytics job.
170+
1. Then, select **Submit**.
210171

172+
:::image type="content" source="./media/quick-create-visual-studio-code/submit-options.png" alt-text="Screenshot showing Submit options.":::
211173
4. Select **Publish to Azure** and complete. Wait for it to open a new tab **Cloud Job View** showing your job's status.
212174

213175
:::image type="content" source="./media/quick-create-visual-studio-code/publish-to-azure.png" lightbox="./media/quick-create-visual-studio-code/publish-to-azure.png" alt-text="Screenshot showing the publish to Azure button in VS Code.":::
214176

215177
## Start the Stream Analytics job and check output
216178

217-
1. On the **Cloud Job View** tab, select **Start** to run your job in the cloud. This process may take a few minutes to complete.
179+
1. On the **Cloud Job View** tab, select **Start** to run your job in the cloud.
218180

219181
:::image type="content" source="./media/quick-create-visual-studio-code/start-asa-job-vs-code.png" lightbox="./media/quick-create-visual-studio-code/start-asa-job-vs-code.png" alt-text="Screenshot showing the Start job button in the Cloud view page.":::
220-
182+
1. On the **Start streaming job** window, select **OK**. This process might take a few minutes to complete.
221183
2. If your job starts successfully, the job status is changed to **Running**. You can see a logical diagram showing how your ASA job is running.
222184

223185
:::image type="content" source="./media/quick-create-visual-studio-code/job-running-status.png" lightbox="./media/quick-create-visual-studio-code/job-running-status.png" alt-text="Screenshot showing the job running status in VS Code.":::

articles/stream-analytics/stream-analytics-quick-create-portal.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ Before defining the Stream Analytics job, you should prepare the input data. The
4949

5050
:::image type="content" source="./media/stream-analytics-quick-create-portal/save-iot-device-connection-string.png" lightbox="./media/stream-analytics-quick-create-portal/save-iot-device-connection-string.png" alt-text="Screenshot showing the copy button next to device connection string.":::
5151

52+
## Run the IoT simulator
53+
54+
1. Open the [Raspberry Pi Azure IoT Online Simulator](https://azure-samples.github.io/raspberry-pi-web-simulator/).
55+
2. Replace the placeholder in Line 15 with the Azure IoT Hub device connection string you saved in a previous section.
56+
3. Select **Run**. The output should show the sensor data and messages that are being sent to your IoT Hub.
57+
58+
:::image type="content" source="./media/stream-analytics-quick-create-portal/ras-pi-connection-string.png" lightbox="./media/stream-analytics-quick-create-portal/ras-pi-connection-string.png" alt-text="Screenshot showing the **Raspberry Pi Azure IoT Online Simulator** page with the sample query.":::
59+
60+
5261
## Create blob storage
5362

5463
1. From the upper left-hand corner of the Azure portal, select **Create a resource**. Select **Storage** under **Categories** on the left menu, and then select **Storage account**.
@@ -129,14 +138,6 @@ In this section, you configure an IoT Hub device input to the Stream Analytics j
129138

130139
:::image type="content" source="./media/stream-analytics-quick-create-portal/add-asa-query.png" lightbox="./media/stream-analytics-quick-create-portal/add-asa-query.png" alt-text="Screenshot showing the **Query** page with the sample query.":::
131140

132-
## Run the IoT simulator
133-
134-
1. Open the [Raspberry Pi Azure IoT Online Simulator](https://azure-samples.github.io/raspberry-pi-web-simulator/).
135-
2. Replace the placeholder in Line 15 with the Azure IoT Hub device connection string you saved in a previous section.
136-
3. Select **Run**. The output should show the sensor data and messages that are being sent to your IoT Hub.
137-
138-
:::image type="content" source="./media/stream-analytics-quick-create-portal/ras-pi-connection-string.png" lightbox="./media/stream-analytics-quick-create-portal/ras-pi-connection-string.png" alt-text="Screenshot showing the **Raspberry Pi Azure IoT Online Simulator** page with the sample query.":::
139-
140141
## Start the Stream Analytics job and check the output
141142

142143
1. Return to the job overview page in the Azure portal, and select **Start job**.

0 commit comments

Comments
 (0)