Skip to content

Commit 74e69e9

Browse files
Merge pull request #262584 from stevemunk/tutorial-geofence-update
Updating Tutorial: Set up a geofence by using Azure Maps
2 parents 55f1561 + a42549b commit 74e69e9

File tree

7 files changed

+24
-44
lines changed

7 files changed

+24
-44
lines changed

articles/azure-maps/azure-maps-event-grid-integration.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: React to Azure Maps events by using Event Grid
33
description: Find out how to react to Azure Maps events involving geofences. See how to listen to map events and how to use Event Grid to reroute events to event handlers.
44
author: eriklindeman
55
ms.author: eriklind
6-
ms.date: 07/16/2020
6+
ms.date: 01/08/2024
77
ms.topic: conceptual
88
ms.service: azure-maps
99
services: azure-maps
@@ -15,9 +15,6 @@ ms.custom: mvc
1515

1616
Azure Maps integrates with Azure Event Grid, so that users can send event notifications to other services and trigger downstream processes. The purpose of this article is to help you configure your business applications to listen to Azure Maps events. This allows users to react to critical events in a reliable, scalable, and secure manner. For example, users can build an application to update a database, create a ticket, and deliver an email notification, every time a device enters a geofence.
1717

18-
> [!NOTE]
19-
> The Geofence API async event requires the region property of your Azure Maps account be set to ***Global***. When creating an Azure Maps account in the Azure portal, this isn't given as an option. For more information, see [Create an Azure Maps account with a global region].
20-
2118
Azure Event Grid is a fully managed event routing service, which uses a publish-subscribe model. Event Grid has built-in support for Azure services like [Azure Functions] and [Azure Logic Apps]. It can deliver event alerts to non-Azure services using webhooks. For a complete list of the event handlers that Event Grid supports, see [An introduction to Azure Event Grid].
2219

2320
![Azure Event Grid functional model](./media/azure-maps-event-grid-integration/azure-event-grid-functional-model.png)
@@ -69,7 +66,6 @@ The following example shows the schema for GeofenceResult:
6966

7067
Applications that handle Azure Maps geofence events should follow a few recommended practices:
7168

72-
* The Geofence API async event requires the region property of your Azure Maps account be set to ***Global***. When creating an Azure Maps account in the Azure portal, this isn't given as an option. For more information, see [Create an Azure Maps account with a global region].
7369
* Configure multiple subscriptions to route events to the same event handler. It's important not to assume that events are from a particular source. Always check the message topic to ensure that the message came from the source that you expect.
7470
* Use the `X-Correlation-id` field in the response header to understand if your information about objects is up to date. Messages can arrive out of order or after a delay.
7571
* When a GET or a POST request in the Geofence API is called with the mode parameter set to `EnterAndExit`, then an Enter or Exit event is generated for each geometry in the geofence for which the status has changed from the previous Geofence API call.
@@ -87,6 +83,5 @@ To learn more about how to use geofencing to control operations at a constructio
8783
[Azure Functions]: ../azure-functions/functions-overview.md
8884
[Azure Logic Apps]: ../azure-functions/functions-overview.md
8985
[Azure Maps as an Event Grid source]: ../event-grid/event-schema-azure-maps.md
90-
[Create an Azure Maps account with a global region]: tutorial-geofence.md#create-an-azure-maps-account-with-a-global-region
9186
[event subscriptions]: ../event-grid/concepts.md#event-subscriptions
9287
[Set up a geofence by using Azure Maps]: tutorial-geofence.md
57.4 KB
Loading
-12.1 KB
Loading
8.12 KB
Loading
14.7 KB
Loading
-16.3 KB
Loading

articles/azure-maps/tutorial-geofence.md

Lines changed: 23 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,22 @@ Azure Maps provides services to support the tracking of equipment entering and e
2222

2323
> [!div class="checklist"]
2424
>
25-
> * Create an Azure Maps account with a global region.
2625
> * Upload [Geofencing GeoJSON data] that defines the construction site areas you want to monitor. You'll upload geofences as polygon coordinates to your Azure storage account, then use the [data registry] service to register that data with your Azure Maps account.
2726
> * Set up two [logic apps] that, when triggered, send email notifications to the construction site operations manager when equipment enters and exits the geofence area.
2827
> * Use [Azure Event Grid] to subscribe to enter and exit events for your Azure Maps geofence. You set up two webhook event subscriptions that call the HTTP endpoints defined in your two logic apps. The logic apps then send the appropriate email notifications of equipment moving beyond or entering the geofence.
2928
> * Use [Search Geofence Get API] to receive notifications when a piece of equipment exits and enters the geofence areas.
3029
3130
## Prerequisites
3231

33-
* This tutorial uses the [Postman] application, but you can use a different API development environment.
32+
* An [Azure Maps account]
33+
* A [subscription key]
34+
* An [Azure storage account]
35+
36+
This tutorial uses the [Postman] application, but you can use a different API development environment.
3437

3538
>[!IMPORTANT]
3639
>
37-
> * In the URL examples, replace `{Your-Azure-Maps-Subscription-key}` with your Azure Maps subscription key.
38-
39-
## Create an Azure Maps account with a global region
40-
41-
The Geofence API async event requires the region property of your Azure Maps account be set to ***Global***. This setting isn't given as an option when creating an Azure Maps account in the Azure portal, however you do have several other options for creating a new Azure Maps account with the *global* region setting. This section lists the three methods that can be used to create an Azure Maps account with the region set to *global*.
42-
43-
> [!NOTE]
44-
> The `location` property in both the ARM template and PowerShell `New-AzMapsAccount` command refer to the same property as the `Region` field in the Azure portal.
45-
46-
### Use an ARM template to create an Azure Maps account with a global region
47-
48-
[Create your Azure Maps account using an ARM template], making sure to set `location` to `global` in the `resources` section of the ARM template.
49-
50-
### Use PowerShell to create an Azure Maps account with a global region
51-
52-
```powershell
53-
New-AzMapsAccount -ResourceGroupName your-Resource-Group -Name name-of-maps-account -SkuName g2 -Location global
54-
```
55-
56-
### Use Azure CLI to create an Azure Maps account with a global region
57-
58-
The Azure CLI command [az maps account create] doesn’t have a location property, but defaults to `global`, making it useful for creating an Azure Maps account with a global region setting for use with the Geofence API async event.
40+
> In the URL examples, replace `{Your-Azure-Maps-Subscription-key}` with your Azure Maps subscription key.
5941
6042
## Upload geofencing GeoJSON data
6143

@@ -149,7 +131,7 @@ Create the geofence JSON file using the following geofence data. You'll upload t
149131
}
150132
```
151133

152-
Follow the steps outlined in the [How to create data registry] article to upload the geofence JSON file into your Azure storage account then register it in your Azure Maps account.
134+
Follow the steps outlined in the [How to create data registry] article to upload the geofence JSON file into your Azure storage account and register it in your Azure Maps account.
153135

154136
> [!IMPORTANT]
155137
> Make sure to make a note of the unique identifier (`udid`) value, you will need it. The `udid` is how you reference the geofence you uploaded into your Azure storage account from your source code and HTTP requests.
@@ -164,40 +146,41 @@ To create the logic apps:
164146

165147
2. In the upper-left corner of the Azure portal, select **Create a resource**.
166148

167-
3. In the **Search the Marketplace** box, type **Logic App**.
149+
3. In the **Search services and marketplace** box, type **Logic App**.
168150

169151
4. From the results, select **Logic App**. Then, select **Create**.
170152

171153
5. On the **Logic App** page, enter the following values:
172154
* The **Subscription** that you want to use for this logic app.
173155
* The **Resource group** name for this logic app. You can choose to **Create new** or **Use existing** resource group.
174156
* The **Logic App name** of your logic app. In this case, use `Equipment-Enter` as the name.
157+
* Select **Consumption** as the **Plan type**. For more information, see [Billing and pricing models] in the Logic App documentation.
175158

176159
For the purposes of this tutorial, keep all other values on their default settings.
177160

178-
:::image type="content" source="./media/tutorial-geofence/logic-app-create.png" alt-text="Screenshot of create a logic app.":::
161+
:::image type="content" border="false" source="./media/tutorial-geofence/logic-app-create.png" alt-text="Screenshot of create a logic app.":::
179162

180-
6. Select **Review + Create**. Review your settings and select **Create**.
163+
6. When you're done, select **Review + Create**. After Azure validates the information about your logic app resource, select **Create**.
181164

182165
7. When the deployment completes successfully, select **Go to resource**.
183166

184-
8. In the **Logic App Designer**, scroll down to the **Start with a common trigger** section. Select **When an HTTP request is received**.
167+
8. Select **Logic app designer** in the **Development Tools** section in the menu of the left, scroll down to the **Start with a common trigger** section. Select **When an HTTP request is received**.
185168

186-
:::image type="content" source="./media/tutorial-geofence/logic-app-trigger.png" alt-text="Screenshot of create a logic app HTTP trigger.":::
169+
:::image type="content" border="false" source="./media/tutorial-geofence/logic-app-trigger.png" alt-text="Screenshot of create a logic app HTTP trigger.":::
187170

188171
9. In the upper-right corner of Logic App Designer, select **Save**. The **HTTP POST URL** is automatically generated. Save the URL. You need it in the next section to create an event endpoint.
189172

190-
:::image type="content" source="./media/tutorial-geofence/logic-app-httprequest.png" alt-text="Screenshot of Logic App HTTP Request URL and JSON.":::
173+
:::image type="content" border="false" source="./media/tutorial-geofence/logic-app-httprequest.png" alt-text="Screenshot of Logic App HTTP Request URL and JSON.":::
191174

192175
10. Select **+ New Step**.
193176

194177
11. In the search box, type `outlook.com email`. In the **Actions** list, scroll down and select **Send an email (V2)**.
195178

196-
:::image type="content" source="./media/tutorial-geofence/logic-app-designer.png" alt-text="Screenshot of create a logic app designer.":::
179+
:::image type="content" border="false" source="./media/tutorial-geofence/logic-app-designer.png" alt-text="Screenshot of create a logic app designer.":::
197180

198181
12. Sign in to your Outlook account. Make sure to select **Yes** to allow the logic app to access the account. Fill in the fields for sending an email.
199182

200-
:::image type="content" source="./media/tutorial-geofence/logic-app-email.png" alt-text="Screenshot of create a logic app send email step.":::
183+
:::image type="content" border="false" source="./media/tutorial-geofence/logic-app-email.png" alt-text="Screenshot of create a logic app send email step.":::
201184

202185
>[!TIP]
203186
> You can retrieve GeoJSON response data, such as `geometryId` or `deviceId`, in your email notifications. You can configure Logic Apps to read the data sent by Event Grid. For information on how to configure Logic Apps to consume and pass event data into email notifications, see [Tutorial: Send email notifications about Azure IoT Hub events using Event Grid and Logic Apps].
@@ -235,7 +218,7 @@ Create geofence exit and enter event subscriptions:
235218
* For **Endpoint Type**, choose `Web Hook`.
236219
* For **Endpoint**, copy the HTTP POST URL for the logic app enter endpoint that you created in the previous section. If you forgot to save it, you can just go back into Logic App Designer and copy it from the HTTP trigger step.
237220

238-
:::image type="content" source="./media/tutorial-geofence/events-subscription.png" alt-text="Screenshot of Azure Maps events subscription details.":::
221+
:::image type="content" border="false" source="./media/tutorial-geofence/events-subscription.png" alt-text="Screenshot of Azure Maps events subscription details.":::
239222

240223
6. Select **Create**.
241224

@@ -495,7 +478,7 @@ In the preceding GeoJSON response, the equipment has remained in the main site g
495478

496479
In the preceding GeoJSON response, the equipment has exited the main site geofence. As a result, the `isEventPublished` parameter is set to `true`, and the Operations Manager receives an email notification indicating that the equipment has exited a geofence.
497480

498-
You can also [Send email notifications using Event Grid and Logic Apps] and check [Supported Events Handlers in Event Grid] using Azure Maps.
481+
You can also [Send email notifications using Event Grid and Logic Apps]. For more information,see [Event handlers in Azure Event Grid].
499482

500483
## Clean up resources
501484

@@ -506,11 +489,12 @@ There are no resources that require cleanup.
506489
> [!div class="nextstepaction"]
507490
> [Handle content types in Azure Logic Apps]
508491

509-
[az maps account create]: /cli/azure/maps/account?view=azure-cli-latest&preserve-view=true#az-maps-account-create
492+
[Azure Maps account]: quick-demo-map-app.md#create-an-azure-maps-account
510493
[Azure Event Grid]: ../event-grid/overview.md
511494
[Azure Maps service geographic scope]: geographic-scope.md
512495
[Azure portal]: https://portal.azure.com
513-
[Create your Azure Maps account using an ARM template]: how-to-create-template.md
496+
[Azure storage account]: /azure/storage/common/storage-account-create?tabs=azure-portal
497+
[Billing and pricing models]: /azure/logic-apps/logic-apps-pricing#standard-pricing
514498
[data registry]: /rest/api/maps/data-registry
515499
[Geofencing GeoJSON data]: geofence-geojson.md
516500
[Handle content types in Azure Logic Apps]: ../logic-apps/logic-apps-content-type.md
@@ -521,7 +505,8 @@ There are no resources that require cleanup.
521505
[Search Geofence Get API]: /rest/api/maps/spatial/getgeofence
522506
[Send email notifications using Event Grid and Logic Apps]: ../event-grid/publish-iot-hub-events-to-logic-apps.md
523507
[Spatial Geofence Get API]: /rest/api/maps/spatial/getgeofence
524-
[Supported Events Handlers in Event Grid]: ../event-grid/event-handlers.md
508+
[subscription key]: quick-demo-map-app.md#get-the-subscription-key-for-your-account
509+
[Event handlers in Azure Event Grid]: ../event-grid/event-handlers.md
525510
[three event types]: ../event-grid/event-schema-azure-maps.md
526511
[Tutorial: Send email notifications about Azure IoT Hub events using Event Grid and Logic Apps]: ../event-grid/publish-iot-hub-events-to-logic-apps.md
527512
[Upload Geofencing GeoJSON data section]: #upload-geofencing-geojson-data

0 commit comments

Comments
 (0)