Skip to content

Commit 335d23f

Browse files
authored
Merge pull request #183503 from ElazarK/leaf-device
added leaf device proxying
2 parents 4262b5a + 93e9b73 commit 335d23f

File tree

6 files changed

+54
-2
lines changed

6 files changed

+54
-2
lines changed

articles/iot-edge/how-to-connect-downstream-iot-edge-device.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: How to configure an IoT Edge device to connect to Azure IoT Edge ga
44
author: kgremban
55

66
ms.author: kgremban
7-
ms.date: 03/01/2021
7+
ms.date: 01/09/2022
88
ms.topic: conceptual
99
ms.service: iot-edge
1010
services: iot-edge
@@ -532,8 +532,60 @@ The API proxy module was designed to be customized to handle most common gateway
532532
1. Select **Review + create** to go to the final step.
533533
1. Select **Create** to deploy to your device.
534534
535+
## Integrate Microsoft Defender for IoT with IoT Edge gateway
536+
537+
Leaf devices can be used to integrate the Microsoft Defender for IoT's micro agent with the IoT Edge gateway using leaf device proxying.
538+
539+
Learn more about the [Defender for IoT micro agent](../defender-for-iot/device-builders/overview.md#defender-for-iot-micro-agent).
540+
541+
**To integrate Microsoft Defender for IoT with IoT Edge using leaf device proxying**:
542+
543+
1. Sign in to the Azure portal.
544+
545+
1. Navigate to **IoT Hub** > **`Your Hub`** > **Device management** > **Devices**
546+
547+
1. Select your device.
548+
549+
:::image type="content" source="media/how-to-connect-downstream-iot-edge-device/select-device.png" alt-text="Screenshot showing where your device is located for selection.":::
550+
551+
1. Select the `DefenderIotMicroAgent` module twin that you created from [these instructions](../defender-for-iot/device-builders/quickstart-create-micro-agent-module-twin.md#create-defenderiotmicroagent-module-twin).
552+
553+
:::image type="content" source="media/how-to-connect-downstream-iot-edge-device/defender-micro-agent.png" alt-text="Screenshot showing the location of the DefenderIotMicroAgent.":::
554+
555+
1. Select the :::image type="icon" source="media/how-to-connect-downstream-iot-edge-device/copy-icon.png" border="false"::: button to copy your Connection string (primary key).
556+
557+
1. Paste the Connection string into a text editing application, and add the GatewayHostName to the string. For example, `HostName=nested11.azure-devices.net;DeviceId=leaf1;ModuleId=module1;SharedAccessKey=xxx;GatewayHostName=10.16.7.4`.
558+
559+
1. Open a terminal on the leaf device.
560+
561+
1. Use the following command to place the connection string encoded in utf-8 in the Defender for Cloud agent directory into the file `connection_string.txt` in the following path: `/var/defender_iot_micro_agent/connection_string.txt`:
562+
563+
```bash
564+
sudo bash -c 'echo "<connection string>" > /var/defender_iot_micro_agent/connection_string.txt'
565+
```
566+
567+
The `connection_string.txt` should now be located in the following path location `/var/defender_iot_micro_agent/connection_string.txt`.
568+
569+
1. Restart the service using this command:
570+
571+
```bash
572+
sudo systemctl restart defender-iot-micro-agent.service
573+
```
574+
575+
1. Navigate back to the device.
576+
577+
:::image type="content" source="media/how-to-connect-downstream-iot-edge-device/device.png" alt-text="Screenshot showing how to navigate back to your device.":::
578+
579+
1. Enable the connection to the IoT Hub, and select the gear icon.
580+
581+
:::image type="content" source="media/how-to-connect-downstream-iot-edge-device/gear-icon.png" alt-text="Screenshot showing what to select to set a parent device.":::
582+
583+
1. Select the parent device from the displayed list.
584+
585+
1. Ensure that port 8883 (MQTT) between the leaf device and the IoT Edge device is open.
586+
535587
## Next steps
536588
537589
[How an IoT Edge device can be used as a gateway](iot-edge-as-gateway.md)
538590
539-
[Configure the API proxy module for your gateway hierarchy scenario](how-to-configure-api-proxy-module.md)
591+
[Configure the API proxy module for your gateway hierarchy scenario](how-to-configure-api-proxy-module.md)
1.06 KB
Loading
70.1 KB
Loading
34.9 KB
Loading
28.1 KB
Loading
21.5 KB
Loading

0 commit comments

Comments
 (0)