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/iot-edge/module-development.md
+34-23Lines changed: 34 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Develop custom modules for Azure IoT Edge that can communicate with
4
4
author: PatAltimore
5
5
6
6
ms.author: patricka
7
-
ms.date: 09/03/2021
7
+
ms.date: 3/17/2023
8
8
ms.topic: conceptual
9
9
ms.service: iot-edge
10
10
services: iot-edge
@@ -26,7 +26,7 @@ To deploy your program on an IoT Edge device, it must first be containerized and
26
26
27
27
## Using the IoT Edge hub
28
28
29
-
The IoT Edge hub provides two main functionalities: proxy to IoT Hub, and local communications.
29
+
The IoT Edge hub provides two main functionalities: a proxy to IoT Hub and local communications.
30
30
31
31
### Connecting to IoT Edge hub from a module
32
32
@@ -36,60 +36,71 @@ To use IoT Edge routing over AMQP, you can use the ModuleClient from the Azure I
36
36
37
37
### IoT Hub primitives
38
38
39
-
IoT Hub sees a module instance analogously to a device, in the sense that:
39
+
IoT Hub sees a module instance as similar to a device. A module instance can:
40
40
41
-
*it can send [device-to-cloud messages](../iot-hub/iot-hub-devguide-messaging.md);
42
-
*it can receive [direct methods](../iot-hub/iot-hub-devguide-direct-methods.md) targeted specifically at its identity.
43
-
*it has a module twin that is distinct and isolated from the [device twin](../iot-hub/iot-hub-devguide-device-twins.md) and the other module twins of that device;
*Receive [direct methods](../iot-hub/iot-hub-devguide-direct-methods.md) targeted specifically at its identity
43
+
*Have a module twin that's distinct and isolated from the [device twin](../iot-hub/iot-hub-devguide-device-twins.md) and the other module twins of that device
44
44
45
45
Currently, modules can't receive cloud-to-device messages or use the file upload feature.
46
46
47
-
When writing a module, you can connect to the IoT Edge hub and use IoT Hub primitives as you would when using IoT Hub with a device application. The only difference between IoT Edge modules and IoT device applications is that you have to refer to the module identity instead of the device identity.
47
+
When writing a module, you can connect to the IoT Edge hub and use IoT Hub primitives as you would when using IoT Hub with a device application. The only difference between IoT Edge modules and IoT device applications is that with modules you have to refer to the module identity instead of the device identity.
48
48
49
49
#### Device-to-cloud messages
50
50
51
-
An IoT Edge module can send messages to the cloud via the IoT Edge hub that acts as a local broker and propagates messages to the cloud. To enable complex processing of device-to-cloud messages, an IoT Edge module can also intercept and process messages sent by other modules or devices to its local IoT Edge hub and send new messages with processed data. Chains of IoT Edge modules can thus be created to build local processing pipelines.
51
+
An IoT Edge module can send messages to the cloud via the IoT Edge hub that acts as a local broker and propagates messages to the cloud. To enable complex processing of device-to-cloud messages, an IoT Edge module can intercept and process messages sent by other modules or devices to its local IoT Edge hub. The IoT Edge module will then send new messages with processed data. Chains of IoT Edge modules can thus be created to build local processing pipelines.
52
52
53
-
To send device-to-cloud telemetry messages using routing, use the ModuleClient of the Azure IoT SDK. With the Azure IoT SDK, each module has the concept of module *input* and *output* endpoints. Use the `ModuleClient.sendMessageAsync` method and it will send messages on the output endpoint of your module. Then configure a route in edgeHub to send this output endpoint to IoT Hub.
53
+
To send device-to-cloud telemetry messages using routes:
54
54
55
-
To process messages using routing, first set up a route to send messages coming from another endpoint (module or device) to the input endpoint of your module, then listen for messages on the input endpoint of your module. Each time a new message comes back, a callback function is triggered by the Azure IoT SDK. Process your message with this callback function and optionally send new messages on your module endpoint queue.
55
+
* Use the Module Client class of the [Azure IoT SDK](https://github.com/Azure/azure-iot-sdks). Each module has *input* and *output* endpoints.
56
+
* Use a send message method from your Module Client class to send messages on the output endpoint of your module.
57
+
* Set up a route in the edgeHub module of your device to send this output endpoint to IoT Hub.
58
+
59
+
To process messages using routes:
60
+
61
+
* Set up a route to send messages coming from another endpoint (module or device) to the input endpoint of your module.
62
+
* Listen for messages on the input endpoint of your module. Each time a new message comes back, a callback function is triggered by the Azure IoT SDK.
63
+
* Process your message with this callback function and (optionally) send new messages in your module endpoint queue.
64
+
65
+
>[!NOTE]
66
+
> To learn more about declaring a route, see [Learn how to deploy modules and establish routes in IoT Edge](module-composition.md#declare-routes)
56
67
57
68
#### Twins
58
69
59
70
Twins are one of the primitives provided by IoT Hub. There are JSON documents that store state information including metadata, configurations, and conditions. Each module or device has its own twin.
60
71
61
-
To get a module twin with the Azure IoT SDK, call the `ModuleClient.getTwin` method.
72
+
*To get a module twin with the [Azure IoT SDK](https://github.com/Azure/azure-iot-sdks), call the `ModuleClient.getTwin` method.
62
73
63
-
To receive a module twin patch with the Azure IoT SDK, implement a callback function and register it with the `ModuleClient.moduleTwinCallback` method from the Azure IoT SDK so that your callback function is triggered each time that a twin patch comes in.
74
+
*To receive a module twin patch with the Azure IoT SDK, implement a callback function and register it with the `ModuleClient.moduleTwinCallback` method from the Azure IoT SDK so that your callback function is triggered each time a twin patch comes in.
64
75
65
76
#### Receive direct methods
66
77
67
-
To receive a direct method with the Azure IoT SDK, implement a callback function and register it with the `ModuleClient.methodCallback` method from the Azure IoT SDK so that your callback function is triggered each time that a direct method comes in.
78
+
To receive a direct method with the [Azure IoT SDK](https://github.com/Azure/azure-iot-sdks), implement a callback function and register it with the `ModuleClient.methodCallback` method from the Azure IoT SDK so that your callback function is triggered each time that a direct method comes in.
68
79
69
80
## Language and architecture support
70
81
71
-
IoT Edge supports multiple operating systems, device architectures, and development languages so that you can build the scenario that matches your needs. Use this section to understand your options for developing custom IoT Edge modules. You can learn more about tooling support and requirements for each language in [Prepare your development and test environment for IoT Edge](development-environment.md).
82
+
IoT Edge supports multiple operating systems, device architectures, and development languages so you can build the scenario that matches your needs. Use this section to understand your options for developing custom IoT Edge modules. You can learn more about tooling support and requirements for each language in [Prepare your development and test environment for IoT Edge](development-environment.md).
72
83
73
84
### Linux
74
85
75
-
For all languages in the following table, IoT Edge supports development for AMD64 and ARM32 Linux containers.
86
+
For all languages in the following table, IoT Edge [supports](support.md) development for AMD64 and most ARM64 Linux containers. There is support for Debian 11 ARM32 containers, as well.
76
87
77
88
| Development language | Development tools |
78
89
| -------------------- | ----------------- |
79
-
| C | Visual Studio Code<br>Visual Studio 2017/2019 |
80
-
| C# | Visual Studio Code<br>Visual Studio 2017/2019 |
90
+
| C | Visual Studio Code<br>Visual Studio 2019/2022|
91
+
| C# | Visual Studio Code<br>Visual Studio 2019/2022|
81
92
| Java | Visual Studio Code |
82
93
| Node.js | Visual Studio Code |
83
94
| Python | Visual Studio Code |
84
95
85
96
>[!NOTE]
86
-
>For cross-platform compilation, like compiling an ARM32 IoT Edge module on an AMD64 development machine, you need to configure the development machine to compile code on target device architecture matching the IoT Edge module. For more information, see [Build and debug IoT Edge modules on your remote device](https://devblogs.microsoft.com/iotdev/easily-build-and-debug-iot-edge-modules-on-your-remote-device-with-azure-iot-edge-for-vs-code-1-9-0/) to configure the development machine to compile code on target device architecture matching the IoT Edge module.
97
+
>For cross-platform compilation, like compiling an ARM32 IoT Edge module on an AMD64 development machine, you need to configure the development machine to compile code on target device architecture matching the IoT Edge module. For more information, see [Use Visual Studio Code to develop and debug modules for Azure IoT Edge](how-to-vs-code-develop-module.md).
87
98
>
88
-
>In addition, support for ARM64 Linux containers is in [public preview](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). For more information, see [Develop and debug ARM64 IoT Edge modules in Visual Studio Code (preview)](https://devblogs.microsoft.com/iotdev/develop-and-debug-arm64-iot-edge-modules-in-visual-studio-code-preview).
99
+
>For more information about ARM64 Linux containers, see [Use Visual Studio Code to develop and debug modules for Azure IoT Edge](how-to-vs-code-develop-module.md).
89
100
90
101
### Windows
91
102
92
-
IoT Edge 1.1 LTS is the last release channel that supports Windows containers. Starting with version 1.2, Windows containers are not supported.
103
+
We no longer support Windows containers. [IoT Edge for Linux on Windows](iot-edge-for-linux-on-windows.md) is the recommended way to run IoT Edge on Windows devices.
93
104
94
105
## Module security
95
106
@@ -99,10 +110,10 @@ To help improve module security, IoT Edge disables some container features by de
99
110
100
111
### Allow elevated Docker permissions
101
112
102
-
In the config file on an IoT Edge device, there's a parameter called `allow_elevated_docker_permissions`. When set to **true**, this flag allows the `--privileged` flag as well as any additional capabilities that you define in the `CapAdd` field of the Docker HostConfig in the [container create options](how-to-use-create-options.md).
113
+
In the config file on an IoT Edge device, there's a parameter called `allow_elevated_docker_permissions`. When set to **true**, this flag allows the `--privileged` flag and any additional capabilities that you define in the `CapAdd` field of the Docker HostConfig in the [container create options](how-to-use-create-options.md).
103
114
104
-
>[!NOTE]
105
-
>Currently, this flag is **true** by default, which allows deployments to grant privileged permissions to modules. We recommend that you set this flag to false to improve device security. In the future, this flag will be set to **false** by default.
115
+
>[!NOTE]
116
+
>Currently, this flag is true by default, which allows deployments to grant privileged permissions to modules. We recommend that you set this flag to false to improve device security.
@@ -29,11 +29,7 @@ If you experience problems while using the Azure IoT Edge service, there are sev
29
29
30
30
Azure IoT Edge modules are implemented as containers, so IoT Edge needs a container engine to launch them. Microsoft provides a container engine, moby-engine, to fulfill this requirement. This container engine is based on the Moby open-source project. Docker CE and Docker EE are other popular container engines. They're also based on the Moby open-source project and are compatible with Azure IoT Edge. Microsoft provides best effort support for systems using those container engines; however, Microsoft can't ship fixes for issues in them. For this reason, Microsoft recommends using moby-engine on production systems.
31
31
32
-
<br>
33
-
<center>
34
-
35
-

36
-
</center>
32
+
:::image type="content" source="./media/support/only-moby-for-production.png" alt-text="Screenshot of the Moby engine as a container runtime.":::
37
33
38
34
## Operating systems
39
35
@@ -50,9 +46,6 @@ Azure IoT Edge runs on most operating systems that can run containers; however,
50
46
51
47
The systems listed in the following tables are supported by Microsoft, either generally available or in public preview, and are tested with each new release.
52
48
53
-
Azure IoT Edge version 1.2 and later only supports modules built as Linux containers. [IoT Edge for Linux on Windows](iot-edge-for-linux-on-windows.md) is the recommended way to run IoT Edge on Windows devices.
54
-
55
-
56
49
#### Linux containers
57
50
58
51
Modules built as Linux containers can be deployed to either Linux or Windows devices. For Linux devices, the IoT Edge runtime is installed directly on the host device. For Windows devices, a Linux virtual machine prebuilt with the IoT Edge runtime runs on the host device.
@@ -73,12 +66,9 @@ Modules built as Linux containers can be deployed to either Linux or Windows dev
73
66
74
67
All Windows operating systems must be minimum build 17763 with all current cumulative updates installed.
75
68
76
-
>[!NOTE]
77
-
>Ubuntu Server 16.04 support ended with the release of IoT Edge version 1.1.
78
-
79
69
#### Windows containers
80
70
81
-
IoT Edge 1.1 LTS is the last release channel that supports Windows containers. Starting with version 1.2, Windows containers aren't supported.
71
+
We no longer support Windows containers. [IoT Edge for Linux on Windows](iot-edge-for-linux-on-windows.md) is the recommended way to run IoT Edge on Windows devices.
82
72
83
73
### Tier 2
84
74
@@ -110,15 +100,11 @@ The following table lists the currently supported releases. IoT Edge release ass
110
100
| Release notes and assets | Type | Release Date | End of Support Date |
|[1.4](https://github.com/Azure/azure-iotedge/releases/tag/1.4.0)| Long-term support (LTS) | August 2022 | November 12, 2024 |
113
-
|[1.1](https://github.com/Azure/azure-iotedge/releases/tag/1.1.0)| Long-term support (LTS) | February 2021 | December 13, 2022 |
114
103
115
104
For more information on IoT Edge version history, see, [Version history](version-history.md#version-history).
116
105
117
-
IoT Edge 1.1 is the first long-term support (LTS) release channel. This version introduced no new features, but will receive security updates and fixes to regressions. IoT Edge 1.1 LTS uses .NET Core 3.1, and will be supported until December 13, 2022 to match the [.NET Core and .NET 5 release lifecycle](https://dotnet.microsoft.com/platform/support/policy/dotnet-core).
118
-
119
106
> [!IMPORTANT]
120
107
> * Every Microsoft product has a lifecycle. The lifecycle begins when a product is released and ends when it's no longer supported. Knowing key dates in this lifecycle helps you make informed decisions about when to upgrade or make other changes to your software. IoT Edge is governed by Microsoft's [Modern Lifecycle Policy](/lifecycle/policies/modern).
121
-
> * With the release of a long-term support channel, we recommend that all current customers running 1.0.x upgrade their devices to 1.1.x to receive ongoing support.
122
108
123
109
IoT Edge uses the Microsoft.Azure.Devices.Client SDK. For more information, see the [Azure IoT C# SDK GitHub repo](https://github.com/Azure/azure-iot-sdk-csharp) or the [Azure SDK for .NET reference content](/dotnet/api/overview/azure/iot/client). The following list shows the version of the client SDK that each release is tested against:
124
110
@@ -139,11 +125,7 @@ IoT Edge uses the Microsoft.Azure.Devices.Client SDK. For more information, see
139
125
140
126
Azure IoT Edge can be run in virtual machines, such as an [Azure Virtual Machine](../virtual-machines/index.yml). Using a virtual machine as an IoT Edge device is common when customers want to augment existing infrastructure with edge intelligence. The family of the host VM OS must match the family of the guest OS used inside a module's container. This requirement is the same as when Azure IoT Edge is run directly on a device. Azure IoT Edge is agnostic of the underlying virtualization technology and works in VMs powered by platforms like Hyper-V and vSphere.
141
127
142
-
<center>
143
-
144
-

145
-
146
-
</center>
128
+
:::image type="content" source="./media/support/edge-on-vm-linux.png" alt-text="Screenshot of an Azure I o T Edge in a virtual machine.":::
0 commit comments