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/how-to-develop-c-module.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,9 +32,7 @@ Because this article uses Visual Studio Code as the main development tool, insta
32
32
To create a module, you need Docker to build the module image, and a container registry to hold the module image:
33
33
*[Docker Community Edition](https://docs.docker.com/install/) on your development machine.
34
34
*[Azure Container Registry](https://docs.microsoft.com/azure/container-registry/) or [Docker Hub](https://docs.docker.com/docker-hub/repos/#viewing-repository-tags)
35
-
36
-
> [!TIP]
37
-
> You can use a local Docker registry for prototype and testing purposes instead of a cloud registry.
35
+
* You can use a local Docker registry for prototype and testing purposes instead of a cloud registry.
38
36
39
37
To test your module on a device, you need an active IoT hub with at least one IoT Edge device. To use your computer as an IoT Edge device, follow the steps in the quickstart for [Windows](quickstart.md) or [Linux](quickstart-linux.md).
40
38
@@ -43,16 +41,24 @@ To test your module on a device, you need an active IoT hub with at least one Io
43
41
Take these steps to create an IoT Edge module based on Azure IoT C SDK using Visual Studio Code and the Azure IoT Edge extension. First you create a solution, and then you generate the first module in that solution. Each solution can contain more than one module.
44
42
45
43
1. In Visual Studio Code, select **View** > **Integrated Terminal**.
46
-
3. Select **View** > **Command Palette**.
47
-
4. In the command palette, enter and run the command **Azure IoT Edge: New IoT Edge Solution**.
44
+
45
+
2. Select **View** > **Command Palette**.
46
+
47
+
3. In the command palette, enter and run the command **Azure IoT Edge: New IoT Edge Solution**.
48
48
49
49

50
50
51
-
5. Browse to the folder where you want to create the new solution. Choose **Select folder**.
52
-
6. Enter a name for your solution.
53
-
7. Select **C Module** as the template for the first module in the solution.
54
-
8. Enter a name for your module. Choose a name that's unique within your container registry.
55
-
9. Provide the name of the module's image repository. VS Code autopopulates the module name with **localhost:5000**. Replace it with your own registry information. If you use a local Docker registry for testing, then **localhost** is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**.
51
+
4. Browse to the folder where you want to create the new solution. Choose **Select folder**.
52
+
53
+
5. Enter a name for your solution.
54
+
55
+
6. Select **C Module** as the template for the first module in the solution.
56
+
57
+
7. Enter a name for your module. Choose a name that's unique within your container registry.
58
+
59
+
8. Provide the name of the module's image repository. VS Code autopopulates the module name with **localhost:5000**. Replace it with your own registry information. If you use a local Docker registry for testing, then **localhost** is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**. Only replace the localhost part of the string, don't delete your module name.
VS Code takes the information you provided, creates an IoT Edge solution, and then loads it in a new window.
58
64
@@ -70,7 +76,7 @@ There are four items within the solution:
70
76
71
77
## Develop your module
72
78
73
-
The default C module code that comes with the solution is located at **modules** > **\<your module name\>** > **main.c**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
79
+
The default C module code that comes with the solution is located at **modules** > [your module name] > **main.c**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
74
80
75
81
When you're ready to customize the C template with your own code, use the [Azure IoT Hub SDKs](../iot-hub/iot-hub-devguide-sdks.md) to build modules that address the key needs for IoT solutions such as security, device management, and reliability.
*[Docker Community Edition](https://docs.docker.com/install/) on your development machine
33
34
*[Azure Container Registry](https://docs.microsoft.com/azure/container-registry/) or [Docker Hub](https://docs.docker.com/docker-hub/repos/#viewing-repository-tags)
34
-
35
-
> [!TIP]
36
-
> You can use a local Docker registry for prototype and testing purposes instead of a cloud registry.
35
+
* You can use a local Docker registry for prototype and testing purposes instead of a cloud registry.
37
36
38
37
To test your module on a device, you need an active IoT hub with at least one IoT Edge device. To use your computer as an IoT Edge device, follow the steps in the quickstart for [Windows](quickstart.md) or [Linux](quickstart-linux.md).
39
38
@@ -51,7 +50,9 @@ Take these steps to create an IoT Edge solution that has one C# function module.
51
50
6. Enter a name for your solution.
52
51
7. Choose **Azure Functions - C#** as the template for the first module in the solution.
53
52
8. Enter a name for your module. Choose a name that's unique within your container registry.
54
-
9. Provide the image repository for the module. VS Code autopopulates the module name with **localhost:5000**. Replace it with your own registry information. If you use a local Docker registry for testing, then **localhost** is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**.
53
+
9. Provide the image repository for the module. VS Code autopopulates the module name with **localhost:5000**. Replace it with your own registry information. If you use a local Docker registry for testing, then **localhost** is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**. Only replace the localhost part of the string, don't delete your module name.
VS Code takes the information you provided, creates an IoT Edge solution with an Azure Functions project, and then loads it in a new window.
57
58
@@ -68,7 +69,7 @@ There are four items within the solution:
68
69
69
70
## Develop your module
70
71
71
-
The default Azure Function code that comes with the solution is located at **modules** > **\<your module name\>** > **EdgeHubTrigger-Csharp** > **run.csx**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
72
+
The default Azure Function code that comes with the solution is located at **modules** > [your module name] > **EdgeHubTrigger-Csharp** > **run.csx**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
72
73
73
74
When you're ready to customize the Azure Function template with your own code, use the [Azure IoT Hub SDKs](../iot-hub/iot-hub-devguide-sdks.md) to build modules that address the key needs for IoT solutions such as security, device management, and reliability.
74
75
@@ -80,7 +81,7 @@ When you're ready to customize the Azure Function template with your own code, u
80
81
2. Rebuild your solution. In the VS Code command palette, enter and run the command **Azure IoT Edge: Build IoT Edge solution**.
81
82
3. In Azure IoT Hub Devices explorer, right-click an IoT Edge device ID, and then select **Create deployment for Edge device**. Select the `deployment.json` file in the `config` folder. You'll see the deployment successfully created with a deployment ID in a VS Code-integrated terminal.
82
83
83
-
Check your container status in VS Code Docker explorer or by running the `docker images` command in the terminal.
84
+
Check your container status in VS Code Docker explorer or by running the `docker ps` command in the terminal.
84
85
85
86
## Start debugging C# functions in VS Code
86
87
1. VS Code keeps debugging configuration information in a `launch.json` file located in a `.vscode` folder in your workspace. This `launch.json` file was generated when you created a new IoT Edge solution. It updates each time you add a new module that supports debugging. Navigate to the debug view. Select the corresponding debug configuration file. The debug option name should be similar to **ModuleName Remote Debug (.NET Core)**.
*[Docker Community Edition](https://docs.docker.com/install/) on your development machine.
35
35
*[Azure Container Registry](https://docs.microsoft.com/azure/container-registry/) or [Docker Hub](https://docs.docker.com/docker-hub/repos/#viewing-repository-tags)
36
-
37
-
> [!TIP]
38
-
> You can use a local Docker registry for prototype and testing purposes instead of a cloud registry.
36
+
* You can use a local Docker registry for prototype and testing purposes instead of a cloud registry.
39
37
40
38
To test your module on a device, you need an active IoT hub with at least one IoT Edge device. To use your computer as an IoT Edge device, follow the steps in the quickstart for [Windows](quickstart.md) or [Linux](quickstart-linux.md).
41
39
@@ -53,7 +51,9 @@ Take these steps to create an IoT Edge module based on .NET Core 2.0 using Visua
53
51
6. Enter a name for your solution.
54
52
7. Select **C# Module** as the template for the first module in the solution.
55
53
8. Enter a name for your module. Choose a name that's unique within your container registry.
56
-
9. Provide the name of the module's image repository. VS Code autopopulates the module name with **localhost:5000**. Replace it with your own registry information. If you use a local Docker registry for testing, then **localhost** is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**.
54
+
9. Provide the name of the module's image repository. VS Code autopopulates the module name with **localhost:5000**. Replace it with your own registry information. If you use a local Docker registry for testing, then **localhost** is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**. Only replace the localhost part of the string, don't delete your module name.
VS Code takes the information you provided, creates an IoT Edge solution, and then loads it in a new window.
59
59
@@ -71,7 +71,7 @@ There are four items within the solution:
71
71
72
72
## Develop your module
73
73
74
-
The default Azure Function code that comes with the solution is located at **modules** > **\<your module name\>** > **Program.cs**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
74
+
The default Azure Function code that comes with the solution is located at **modules** > [your module name] > **Program.cs**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
75
75
76
76
When you're ready to customize the C# template with your own code, use the [Azure IoT Hub SDKs](../iot-hub/iot-hub-devguide-sdks.md) to build modules that address the key needs for IoT solutions such as security, device management, and reliability.
*[Azure Container Registry](https://docs.microsoft.com/azure/container-registry/) or [Docker Hub](https://docs.docker.com/docker-hub/repos/#viewing-repository-tags)
36
-
37
-
>[!TIP]
38
-
>You can use a local Docker registry for prototype and testing purposes, instead of a cloud registry.
36
+
* You can use a local Docker registry for prototype and testing purposes, instead of a cloud registry.
39
37
40
38
To test your module on a device, you need an active IoT hub with at least one IoT Edge device. If you want to use your computer as an IoT Edge device, you can do so by following the steps in the tutorials for [Windows](quickstart.md) or [Linux](quickstart-linux.md).
41
39
@@ -58,7 +56,9 @@ The following steps show you how to create an IoT Edge module based on Node.js u
58
56
6. Provide a name for your solution.
59
57
7. Choose **Node.js Module** as the template for the first module in the solution.
60
58
8. Provide a name for your module. Choose a name that's unique within your container registry.
61
-
9. Provide the image repository for the module. VS Code autopopulates the module name, so you just have to replace **localhost:5000** with your own registry information. If you use a local Docker registry for testing, then localhost is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**.
59
+
9. Provide the image repository for the module. VS Code autopopulates the module name, so you just have to replace **localhost:5000** with your own registry information. If you use a local Docker registry for testing, then localhost is fine. If you use Azure Container Registry, then use the login server from your registry's settings. The login server looks like **\<registry name\>.azurecr.io**. Only replace the localhost part of the string, don't delete your module name.
VS Code takes the information you provided, creates an IoT Edge solution, then loads it in a new window.
64
64
@@ -74,7 +74,7 @@ Within the solution you have three items:
74
74
75
75
## Develop your module
76
76
77
-
The default Node.js code that comes with the solution is located at **modules** > **\<your module name\>** > **app.js**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
77
+
The default Node.js code that comes with the solution is located at **modules** > [your module name] > **app.js**. The module and the deployment.template.json file are set up so that you can build the solution, push it to your container registry, and deploy it to a device to start testing without touching any code. The module is built to simply take input from a source (in this case, the tempSensor module that simulates data) and pipe it to IoT Hub.
78
78
79
79
When you're ready to customize the Node.js template with your own code, use the [Azure IoT Hub SDKs](../iot-hub/iot-hub-devguide-sdks.md) to build modules that address the key needs for IoT solutions such as security, device management, and reliability.
Copy file name to clipboardExpand all lines: articles/iot-edge/module-composition.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,7 +148,7 @@ For examples about how to create queries for message properties, see [Device-to-
148
148
An example that is specific to IoT Edge is when you want to filter for messages that arrived at a gateway device from a leaf device. Messages that come from modules contain a system property called **connectionModuleId**. So if you want to route messages from leaf devices directly to IoT Hub, use the following route to exclude module messages:
149
149
150
150
```sql
151
-
FROM/messages/* WHERE NOT IS_DEFINED($connectionModuleId) INTO $upstream
151
+
FROM/messages/\*WHERE NOT IS_DEFINED($connectionModuleId) INTO $upstream
0 commit comments