Skip to content

Commit 32526d7

Browse files
committed
Automate sensor disconnection notifications - tutorial
1 parent b654ced commit 32526d7

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: Set up automatic sensor disconnection notifications
3+
description: This tutorial describes how to use the Microsoft Sentinel data connector and solution for Microsoft Defender for IoT to secure your entire environment. Detect and respond to threats, including multistage attacks that may cross IT and OT boundaries.
4+
ms.topic: tutorial
5+
ms.date: 01/06/2025
6+
ms.subservice: sentinel-integration
7+
---
8+
9+
# Tutorial: Set up automatic sensor disconnection notifications with Microsoft Defender for IoT
10+
11+
This tutorial shows you how to create a [playbook](../../sentinel/tutorial-respond-threats-playbook.md) in Microsoft Sentinel that automatically sends an email notification when a sensor disconnects.
12+
13+
In this tutorial, you:
14+
15+
> [!div class="checklist"]
16+
>
17+
> * Create the playbook
18+
> * Set up managed identity for your subscription
19+
> * Verify the sensor status
20+
21+
## Prerequisites
22+
23+
Before you start, make sure you have:
24+
25+
- **Read** and **Write** permissions on your Microsoft Sentinel workspace. For more information, see [Permissions in Microsoft Sentinel](../../sentinel/roles.md).
26+
27+
- Completed [Tutorial: Connect Microsoft Defender for IoT with Microsoft Sentinel](iot-solution.md).
28+
29+
- The subscription ID and the resource group for the relevant subscription. In the Azure portal **Subscriptions** page, copy the subscription ID and resource group and save them for a later stage.
30+
31+
## Create the playbook
32+
33+
1. In Microsoft Sentinel, select **Automation**.
34+
1. In the **Automation** page, select **Create > Playbook with alert trigger**.
35+
1. In the **Create playbook** page **Basics** tab, select the subscription and resource group running Microsoft Sentinel, and give the playbook a name.
36+
1. Select **Next: Connections**.
37+
1. In the **Connections** tab, select **Microsoft Sentinel > Connect with managed identity**.
38+
1. Review the playbook information and select **Create playbook**.
39+
40+
When the playbook is ready, Microsoft Sentinel displays a **Deployment successful** message and navigates to the **Logic app designer** page.
41+
42+
1. Select **Logic app code view**, modify these fields in the following code, and paste the code into the editor:
43+
- Under the `post` body, in the `To` field, type the email to which you want to receive the notifications.
44+
- Under the `office365` parameter:
45+
- Under the `id` field, replace `Replace with subscription` with the ID of the subscription running Microsoft Sentinel, for example:
46+
47+
```json
48+
"id": "/subscriptions/exampleID/providers/Microsoft.Web/locations/eastus/managedApis/office365"
49+
```
50+
51+
- Under the `connectionId` field, replace `Replace with subscription` with your subscription ID, and replace `Replace with RG name` with your resource group name, for example:
52+
53+
```json
54+
"connectionId": "/subscriptions/exampleID/resourceGroups/ExampleResourceGroup/providers/Microsoft.Web/connections/office365"
55+
```
56+
57+
1. Select **Save**.
58+
1. Go back to the **Logic app designer** to view the workflow that the playbook follows.
59+
60+
## Set up managed identity for your subscription
61+
62+
1. In the Azure portal, select **Subscriptions**.
63+
1. Select the subscription running Microsoft Sentinel and select **Access Control (IAM)**.
64+
1. Select **Add > Add Role Assignment**.
65+
1. Search for the **Reader** role.
66+
1. In the **Role** tab, select **Next**.
67+
1. In the **Members** tab, under **Assign access to**, select **Managed Identity**.
68+
1. In the **Select Managed identities** window:
69+
1. Under **Subscription**, select the subscription running Microsoft Sentinel.
70+
1. Under **Managed identity**, select **Logic app 5**.
71+
1. Under **Select**, select the name of the automation rule you created and select **Select**.
72+
1. In the editor, select **HTTP2** and verify that the **Authentication Type** is set to **Managed Identity**.
73+
74+
## Verify the sensor status
75+
76+
If you can't create the playbook successfully, run a Keyword Query Language (KQL) query in Azure Resource Graph to confirm that the sensor is offline.
77+
78+
1. In the Azure portal, search for *Azure resource graph explorer*.
79+
1. Run the following query:
80+
81+
```kusto
82+
iotsecurityresources
83+
84+
| where type =='microsoft.iotsecurity/locations/sites/sensors'
85+
86+
|extend Status=properties.sensorStatus
87+
88+
|extend LastConnectivityTime=properties.connectivityTime
89+
90+
|extend Status=iif(LastConnectivityTime<ago(5m),'Disconnected',Status)
91+
92+
|project SensorName=name, Status, LastConnectivityTime
93+
94+
|where Status == 'Disconnected'
95+
```
96+
97+
If the sensor has been offline for at least five minutes, the sensor status is **Disconnected**.
98+
99+
> [!NOTE]
100+
> It takes up to 15 minutes for the sensor to synchronize the status update with the cloud. This means that you should wait at least 15 minutes before checking the status.
101+
102+
## Next steps
103+
104+
> [!div class="nextstepaction"]
105+
> [Visualize data](../../sentinel/get-visibility.md)
106+
107+
> [!div class="nextstepaction"]
108+
> [Create custom analytics rules](../../sentinel/detect-threats-custom.md)
109+
110+
> [!div class="nextstepaction"]
111+
> [Investigate incidents](../../sentinel/investigate-cases.md)
112+
113+
> [!div class="nextstepaction"]
114+
> [Investigate entities](../../sentinel/entity-pages.md)
115+
116+
> [!div class="nextstepaction"]
117+
> [Use playbooks with automation rules](../../sentinel/tutorial-respond-threats-playbook.md)
118+
119+
For more information, see our blog: [Defending Critical Infrastructure with the Microsoft Sentinel: IT/OT Threat Monitoring Solution](https://techcommunity.microsoft.com/t5/microsoft-sentinel-blog/defending-critical-infrastructure-with-the-microsoft-sentinel-it/ba-p/3061184)

0 commit comments

Comments
 (0)