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/azure-maps/tutorial-iot-hub-maps.md
+19-10Lines changed: 19 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ In this tutorial you will:
23
23
> [!div class="checklist"]
24
24
>
25
25
> * Create an Azure storage account to log car tracking data.
26
-
> * Upload a geofence to the Azure Maps Data service by using the Data Upload API.
26
+
> * Upload a geofence to the Azure Maps Data service using the Data Upload API.
27
27
> * Create a hub in Azure IoT Hub, and register a device.
28
28
> * Create a function in Azure Functions, implementing business logic based on Azure Maps spatial analytics.
29
29
> * Subscribe to IoT device telemetry events from the Azure function via Azure Event Grid.
@@ -38,6 +38,9 @@ If you don't have an Azure subscription, create a [free account] before you begi
38
38
* A [resource group]
39
39
* The [rentalCarSimulation] C# project
40
40
41
+
> [!TIP]
42
+
> You can download the entire [rentalCarSimulation] C# project from GitHub as a single ZIP file by going to [the root of the sample] and selecting the green **<> Code** button, then **Download ZIP**.
43
+
41
44
This tutorial uses the [Postman] application, but you can choose a different API development environment.
42
45
43
46
>[!IMPORTANT]
@@ -108,7 +111,7 @@ When you successfully create your storage account, you then need to create a con
108
111
109
112
:::image type="content" source="./media/tutorial-iot-hub-maps/container-new.png" alt-text="Screenshot of create a blob container.":::
110
113
111
-
3. Go to the **Access keys** pane in your storage account, and copy the **Storage account name** and the **Key** value in the **key1** section. You need both of these values in the "Create an Azure Function and add an Event Grid subscription" section.
114
+
3. Go to the **Access keys** pane in your storage account, and copy the **Storage account name** and the **Key** value in the **key1** section. You need both of these values in the [Create a function and add an Event Grid subscription] section.
112
115
113
116
:::image type="content" source="./media/tutorial-iot-hub-maps/access-keys.png" alt-text="Screenshot of copy storage account name and key.":::
114
117
@@ -128,7 +131,7 @@ Follow these steps to upload the geofence by using the Azure Maps Data Upload AP
128
131
129
132
In the URL path, the `geojson` value against the `dataFormat` parameter represents the format of the data being uploaded.
130
133
131
-
3. Select **Body** > **raw** for the input format, and choose **JSON** from the drop-down list. [Open the JSON data file], and copy the JSON into the body section. Select **Send**.
134
+
3. Select **Body** > **raw** for the input format, and choose **JSON** from the drop-down list. [Open the JSON data file], and copy the JSON into the body section.
132
135
133
136
4. Select **Send** and wait for the request to process. After the request completes, go to the **Headers** tab of the response. Copy the value of the **Operation-Location** key, which is the `status URL`.
134
137
@@ -168,20 +171,24 @@ Now, set up your Azure function.
168
171
169
172
1. In the Azure portal dashboard, select **Create a resource**. Type **Function App** in the search text box. Select **Function App** > **Create**.
170
173
171
-
1. On the **Function App** creation page, name your function app. Under **Resource Group**, select **ContosoRental** from the drop-down list. Select **.NET** as the **Runtime Stack**. Select **3.1** as the **Version**. At the bottom of the page, select **Next: Hosting >**.
174
+
1. On the **Function App** creation page, name your function app. Under **Resource Group**, select **ContosoRental** from the drop-down list. Select **.NET** as the **Runtime Stack**. At the bottom of the page, select **Next: Storage >**.
172
175
173
176
:::image type="content" source="./media/tutorial-iot-hub-maps/rental-app.png" alt-text="Screenshot of create a function app.":::
174
177
175
178
1. For **Storage account**, select the storage account you created in [Create an Azure storage account]. Select **Review + create**.
176
179
177
180
1. Review the function app details, and select **Create**.
178
181
179
-
1. After the app is created, you add a function to it. Go to the function app. Select the **Functions** pane. At the top of the page, select **+ Add**. The function template panel appears. Scroll down the panel, and select **Azure Event Grid trigger**.
182
+
1. After the app is created, you add a function to it. Go to the function app. Select the **Create in Azure Portal** button.
180
183
181
184
>[!IMPORTANT]
182
-
> The **Azure Event Hub Trigger** and the **Azure Event Grid Trigger** templates have similar names. Make sure you select the **Azure Event Grid Trigger** template.
185
+
> The **Azure Event ***Hub*** Trigger** and the **Azure Event ***Grid*** Trigger** templates have similar names. Make sure you select the **Azure Event ***Grid*** Trigger** template.
186
+
187
+
:::image type="content" source="./media/tutorial-iot-hub-maps/function-create.png" alt-text="Screenshot of create a function in Azure Portal.":::
188
+
189
+
1. The **Create function** panel appears. Scroll down the **Select a template** panel, and select **Azure Event Grid trigger** then select the **Create** button.
183
190
184
-
:::image type="content" source="./media/tutorial-iot-hub-maps/function-create.png" alt-text="Screenshot of create a function.":::
191
+
:::image type="content" source="./media/tutorial-iot-hub-maps/azure-event-grid-trigger.png" alt-text="Screenshot of create a function.":::
185
192
186
193
1. Give the function a name. In this tutorial, use the name *GetGeoFunction*, but in general you can use any name you like. Select **Create function**.
187
194
@@ -225,13 +232,13 @@ In your example scenario, you only want to receive messages when the rental car
225
232
226
233
## Send telemetry data to IoT Hub
227
234
228
-
When your Azure function is running, you can now send telemetry data to the IoT hub, which routes it to Event Grid. Use a C# application to simulate location data for an in-vehicle device of a rental car. To run the application, you need [.NET Core SDK 3.1] on your development computer. Follow these steps to send simulated telemetry data to the IoT hub:
235
+
When your Azure function is running, you can now send telemetry data to the IoT hub, which routes it to Event Grid. Use a C# application to simulate location data for an in-vehicle device of a rental car. To run the application, you need [.NET SDK 6.0] on your development computer. Follow these steps to send simulated telemetry data to the IoT hub:
229
236
230
237
1. If you haven't done so already, download the [rentalCarSimulation] C# project.
231
238
232
239
2. Open the `simulatedCar.cs` file in a text editor of your choice, and replace the value of the `connectionString` with the one you saved when you registered the device. Save changes to the file.
233
240
234
-
3. Make sure you have .NET Core installed on your machine. In your local terminal window, go to the root folder of the C# project and run the following command to install the required packages for simulated device application:
241
+
3. Make sure you have the ASP.NET Core Runtime installed on your machine. In your local terminal window, go to the root folder of the C# project and run the following command to install the required packages for simulated device application:
235
242
236
243
```cmd/sh
237
244
dotnet restore
@@ -283,7 +290,7 @@ To learn more about how to send device-to-cloud telemetry, and the other way aro
0 commit comments