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-vs-code-develop-module.md
+26-15Lines changed: 26 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,9 +72,9 @@ To build and deploy your module image, you need Docker to build the module image
72
72
73
73
::: zone pivot="iotedge-dev-cli"
74
74
75
-
- Install the Python-based [Azure IoT Edge Dev Tool](https://pypi.org/project/iotedgedev/) in order to set up your local development environment to debug, run, and test your IoT Edge solution. If you haven't already, install [Python (3.6/3.7)](https://www.python.org/downloads/) and Pip3 and then install the IoT Edge Dev Tool (iotedgedev) with the following command in your terminal.
75
+
- Install the Python-based [Azure IoT Edge Dev Tool](https://pypi.org/project/iotedgedev/)with the following command in your terminal to set up your local development environment to debug, run, and test your IoT Edge solution. [Python (3.6/3.7)](https://www.python.org/downloads/) and [Pip3](https://pip.pypa.io/en/stable/installation/) are required.
76
76
77
-
```cmd
77
+
```bash
78
78
pip3 install iotedgedev
79
79
```
80
80
@@ -114,7 +114,7 @@ Install prerequisites specific to the language you're developing in:
114
114
- Install [Python Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
115
115
- Install the Python-based [Azure IoT Edge Dev Tool](https://pypi.org/project/iotedgedev/) to debug, run, and test your IoT Edge solution. You can alternatively install the Azure IoT Edge Dev Tool using the CLI:
116
116
117
-
```cmd
117
+
```bash
118
118
pip3 install iotedgedev
119
119
```
120
120
@@ -137,13 +137,13 @@ The following steps show you how to create an IoT Edge module in your preferred
137
137
138
138
The [IoT Edge Dev Tool](https://github.com/Azure/iotedgedev) simplifies Azure IoT Edge development to simple commands driven by environment variables. It gets you started with IoT Edge development with the IoT Edge Dev Container and IoT Edge solution scaffolding that contains a default module and all the required configuration files.
139
139
140
-
1. Create a directory for your solution.
140
+
1. Create a directory for your solution with the filepath of your choice. Change into your `iotedgesolution` directory.
141
141
142
142
```bash
143
143
mkdir c:\dev\iotedgesolution
144
144
```
145
145
146
-
1. Use the **iotedgedev solution init**command to create a solution and set up your Azure IoT Hub. Use the following command to create an IoT Edge solution fora specified development language.
146
+
1. Use the **iotedgedev solution init** command to create a solution and set up your Azure IoT Hubfor your development language.
147
147
148
148
# [C\#](#tab/csharp)
149
149
@@ -193,11 +193,12 @@ The *iotedgedev solution init* script prompts you to complete several steps incl
193
193
* Choose or create an Azure IoT Hub
194
194
* Choose or create an Azure IoT Edge device
195
195
196
-
After solution creation, there are four items within the solution:
196
+
After solution creation, these main files are in the solution:
197
197
198
-
- A **.vscode** folder contains configuration file *launch.json*.
199
-
- A **modules** folder has subfolders for each module. Within the subfolder for each module, the *module.json* file controls how modules are built and deployed.
200
-
- An **.env** file lists your environment variables. The environment variable for the container registry is *localhost* by default. If Azure Container Registry is your registry, set an Azure Container Registry username and password. For example,
198
+
- A **modules** folder.
199
+
- An **.env** file lists your environment variables. The environment variable for the container registry is *localhost:5000* by default. If Azure Container Registry is your registry, set an Azure Container Registry username and password. Get these values from your container registry's **Settings**>**Access keys** menu in the Azure portal. The **CONTAINER_REGISTRY_SERVER** is the **Login server** of your registry.
200
+
201
+
For example:
201
202
202
203
```env
203
204
CONTAINER_REGISTRY_SERVER="myacr.azurecr.io"
@@ -210,7 +211,7 @@ After solution creation, there are four items within the solution:
210
211
> [!NOTE]
211
212
> The environment file is only created if you provide an image repository for the module. If you accepted the localhost defaults to test and debug locally, then you don't need to declare environment variables.
212
213
213
-
- Two module deployment files named **deployment.template.json** and **deployment.debug.template** list the modules to deploy to your device. By default, the list includes the IoT Edge system modules and two sample modules:
214
+
- Two module deployment files named **deployment.template.json** and **deployment.debug.template.json** list the modules to deploy to your device. By default, the list includes the IoT Edge system modules and two sample modules:
214
215
- **filtermodule** is a sample module that implements a simple filter function.
215
216
- **SimulatedTemperatureSensor** module that simulates data you can use for testing. For more information about how deployment manifests work, see [Learn how to use deployment manifests to deploy modules and establish routes](module-composition.md). For more information on how the simulated temperature module works, see the [SimulatedTemperatureSensor.csproj source code](https://github.com/Azure/iotedge/tree/master/edge-modules/SimulatedTemperatureSensor).
216
217
@@ -395,9 +396,17 @@ Run the command **Azure IoT Edge: Add IoT Edge Module** from the command palette
395
396
# [Python](#tab/python)
396
397
397
398
1. Create a new directory folder in the *modules* folder and change directory to the new folder. For example, `mkdir pythonmodule` then `cd pythonmodule`.
398
-
1. Download a ZIP of the contents of the [Cookiecutter Template for Azure IoT Edge Python Module](https://github.com/azure/cookiecutter-azure-iot-edge-module) from GitHub.
399
-
1. Extract the contents of the `{{cookiecutter.module_name}}` folder in the ZIP file then copy the files into the new module directory.
400
-
1. Update *module.json* file with correct repository. For example, if you want to use the repository defined in your environment variables, use `${CONTAINER_REGISTRY_SERVER}/cmodule`.
399
+
1. Get the `cookiecutter-azure-iot-edge-module` from GitHub with one of these methods:
400
+
* From another Bash terminal instance, clone the repository to your desktop with the command:
* Download a ZIP of the contents of the [Cookiecutter Template for Azure IoT Edge Python Module](https://github.com/azure/cookiecutter-azure-iot-edge-module).
405
+
1. Extract (if a ZIP file) the contents of the `{{cookiecutter.module_name}}` folder then copy the files into your new module directory. In this tutorial, we call this new directory **pythonmodule**.
406
+
407
+
:::image type="content" source="media/how-to-vs-code-develop-module/modules-folder-structure.png" alt-text="Screenshot of the expected folder structure for your I o T Edge solution.":::
408
+
409
+
1. Update the *module.json* file with the correct repository. For example, if you want to use the repository defined in your environment variables, use `${CONTAINER_REGISTRY_SERVER}/cmodule`, instead of `{{cookiecutter.image_repository}}`.
:::image type="content" source="media/how-to-vs-code-develop-module/main-file-location.png" alt-text="Screenshot of the location of your main.py file.":::
444
+
434
445
---
435
446
436
447
The sample modules allow you to build the solution, push to your container registry, and deploy to a device. This process lets you start testing without modifying any code. The sample module takes input from a source (in this case, the *SimulatedTemperatureSensor* module that simulates data) and pipes it to IoT Hub.
@@ -451,7 +462,7 @@ Debugging a module without a container isn't available when using *C* or *Python
451
462
452
463
In the Visual Studio Code integrated terminal, change the directory to the ***<your module name>*** folder, and then run the following command to build .NET Core application.
453
464
454
-
```cmd
465
+
```bash
455
466
dotnet build
456
467
```
457
468
@@ -480,7 +491,7 @@ Navigate to the Visual Studio Code Debug view by selecting the debug icon from t
480
491
481
492
In the Visual Studio Code integrated terminal, change the directory to the ***<your module name>*** folder, and then run the following command to install Node packages
0 commit comments