Prepare your development and test environment for IoT Edge
Applies to: IoT Edge 1.4
IoT Edge moves your existing business logic to devices operating at the edge. To prepare your applications and workloads to run as IoT Edge modules, you need to build them as containers. This article provides guidance around how to configure your development environment so that you can successfully create an IoT Edge solution. Once you have your development environment set up, you can learn how to Develop your own IoT Edge modules.
In any IoT Edge solution, there are at least two machines to consider: the IoT Edge device (or devices) that runs the IoT Edge module, and the development machine that builds, tests, and deploys modules. This article focuses primarily on the development machine. For testing purposes, the two machines can be the same. You can run IoT Edge on your development machine and deploy modules to it.
IoT Edge runs on a specific set of supported operating systems. When developing for IoT Edge, you can use most operating systems that can run a container engine. The container engine is a requirement on the development machine to build your modules as containers and push them to a container registry.
If your development machine can't run IoT Edge, skip to the Testing tools section of this article to learn how to test and debug locally.
The operating systems of the development machine and IoT Edge devices don't need to match. However, the container operating system must be consistent with the development machine and the IoT Edge device. For example, you can develop modules on a Windows machine and deploy them to a Linux device. The Windows machine needs to run Linux containers to build the modules for the Linux device.
The central concept of IoT Edge is that you can remotely deploy your business and cloud logic to devices by packaging it into containers. To build containers, you need a container engine on your development machine.
The only supported container engine for IoT Edge devices in production is Moby. However, any container engine compatible with the Open Container Initiative, like Docker, is capable of building IoT Edge module images.
Both Visual Studio and Visual Studio Code have add-on extensions to help develop IoT Edge solutions. These extensions provide language-specific templates to help create and deploy new IoT Edge scenarios. The Azure IoT Edge extensions for Visual Studio and Visual Studio Code help you code, build, deploy, and debug your IoT Edge solutions. You can create an entire IoT Edge solution that contains multiple modules, and the extensions automatically update a deployment manifest template with each new module addition. The extensions also enable management of IoT devices from within Visual Studio or Visual Studio Code. You can deploy modules to a device, monitor the status, and view messages as they arrive at IoT Hub. Finally, both extensions use the IoT EdgeHub dev tool to enable local running and debugging of modules on your development machine.
If you prefer to develop with other editors or from the CLI, the Azure IoT Edge dev tool provides commands so that you can develop and test from the command line. You can create new IoT Edge scenarios, build module images, run modules in a simulator, and monitor messages sent to IoT Hub.
Visual Studio Code extension
The Azure IoT Edge extension for Visual Studio Code provides IoT Edge module templates built on programming languages including C, C#, Java, Node.js, and Python. Templates for Azure functions in C# are also included.
For more information and to download, see Azure IoT Edge for Visual Studio Code.
In addition to the IoT Edge extensions, you may find it helpful to install additional extensions for developing. For example, you can use Docker Support for Visual Studio Code to manage your images, containers, and registries. Additionally, all the major supported languages have extensions for Visual Studio Code that can help when you're developing modules.
The Azure IoT Hub extension is useful as a companion for the Azure IoT Edge extension.
The module templates for some languages and services have prerequisites that are necessary to build the project folders on your development machine with Visual Studio Code.
|Azure Functions||.NET Core SDK|
|C#||.NET Core SDK|
Visual Studio 2017/2019 extension
The Azure IoT Edge tools for Visual Studio provide an IoT Edge module template built on C# and C.
For more information and to download, see Azure IoT Edge Tools for Visual Studio 2017 or Azure IoT Edge Tools for Visual Studio 2019.
IoT Edge dev tool
The Azure IoT Edge dev tool simplifies IoT Edge development with command-line abilities. This tool provides CLI commands to develop, debug, and test modules. The IoT Edge dev tool works with your development system, whether you've manually installed the dependencies on your machine or are using the IoT Edge dev container.
For more information and to get started, see IoT Edge dev tool wiki.
Several testing tools exist to help you simulate IoT Edge devices or debug modules more efficiently. The table below shows a high-level comparison between the tools and the following individual sections describe each tool more specifically.
Only the IoT Edge runtime is supported for production deployments, but the following tools allow you to simulate or easily create IoT Edge devices for development and testing purposes. These tools aren't mutually exclusive, but can work together for a complete development experience.
|Tool||Also known as||Supported platforms||Best for|
|IoT EdgeHub dev tool||iotedgehubdev||Windows, Linux, macOS||Simulating a device to debug modules.|
|IoT Edge dev container||iotedgedev||Windows, Linux, macOS||Developing without installing dependencies.|
IoT EdgeHub dev tool
The Azure IoT EdgeHub dev tool provides a local development and debug experience. The tool helps start IoT Edge modules without the IoT Edge runtime so that you can create, develop, test, run, and debug IoT Edge modules and solutions locally. You don't have to push images to a container registry and deploy them to a device for testing.
The IoT EdgeHub dev tool was designed to work in tandem with the Visual Studio and Visual Studio Code extensions, as well as with the IoT Edge dev tool. The dev tool supports inner loop development as well as outer loop testing, so it integrates with other DevOps tools too.
For more information and to install, see Azure IoT EdgeHub dev tool.
IoT Edge dev container
The Azure IoT Edge dev container is a Docker container that has all the dependencies that you need for IoT Edge development. This container makes it easy to get started with whichever language you want to develop in, including C#, Python, Node.js, and Java. All you need to install is a container engine, like Docker or Moby, to pull the container to your development machine.
For more information, see Azure IoT Edge dev container.
When you're ready to develop at-scale solutions for extensive production scenarios, take advantage of modern DevOps principles including automation, monitoring, and streamlined software engineering processes. IoT Edge has extensions to support DevOps tools including Azure DevOps, Azure DevOps Projects, and Jenkins. If you want to customize an existing pipeline or use a different DevOps tool like CircleCI or TravisCI, you can do so with the CLI features included in the IoT Edge dev tool.
For more information, guidance, and examples, see the following pages:
Submit and view feedback for