{"id":1195,"date":"2018-02-12T16:11:43","date_gmt":"2018-02-12T08:11:43","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/iotdev\/?p=1195"},"modified":"2019-02-15T10:27:11","modified_gmt":"2019-02-15T02:27:11","slug":"deploy-azure-iot-edge-preview-on-a-simulated-device-with-visual-studio-code","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/iotdev\/deploy-azure-iot-edge-preview-on-a-simulated-device-with-visual-studio-code\/","title":{"rendered":"Deploy Azure IoT Edge (preview) on a simulated device with Visual Studio Code"},"content":{"rendered":"<p>Azure IoT Edge enables you to perform analytics and data processing on your devices, instead of having to push all the data to the cloud. The IoT Edge tutorials demonstrate how to deploy different types of modules, built from Azure services or custom code, but first you need a device to test.<\/p>\n<p>In this tutorial you learn how to:<\/p>\n<ol>\n<li>Create an IoT Hub<\/li>\n<li>Register an IoT Edge device<\/li>\n<li>Start the IoT Edge runtime<\/li>\n<li>Deploy a module<\/li>\n<\/ol>\n<p>The simulated device that you create in this tutorial is a monitor on a wind turbine that generates temperature, humidity, and pressure data. You&#8217;re interested in this data because your turbines perform at different levels of efficiency depending on the weather conditions. The other Azure IoT Edge tutorials build upon the work you do here by deploying modules that analyze the data for business insights.<\/p>\n<h2><a id=\"user-content-prerequisites\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#prerequisites\"><\/a>Prerequisites<\/h2>\n<p>This tutorial assumes that you&#8217;re using a computer or virtual machine to simulate an Internet of Things device.<\/p>\n<ol>\n<li>Install Docker and make sure it&#8217;s running.<\/li>\n<li>Install Python and make sure you can use the pip command.<\/li>\n<li>Run the following command to download the IoT Edge control script.\n<div class=\"highlight highlight-source-batchfile\">\n<pre>pip install -U azure-iot-edge-runtime-ctl<\/pre>\n<\/div>\n<\/li>\n<li>Install\u00a0<a href=\"https:\/\/code.visualstudio.com\/\" rel=\"nofollow\">Visual Studio Code<\/a><\/li>\n<li>Install\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=vsciot-vscode.azure-iot-edge\" rel=\"nofollow\">Azure IoT Edge extension<\/a><\/li>\n<\/ol>\n<h2><a id=\"user-content-create-an-iot-hub\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#create-an-iot-hub\"><\/a>Create an IoT hub<\/h2>\n<p>Start the tutorial by creating your IoT Hub.<\/p>\n<ol>\n<li>In Visual Studio Code, select\u00a0<strong>IoT Hub Devices<\/strong>.<\/li>\n<li>Select\u00a0 <strong>&#8230;<\/strong>\u00a0 then select\u00a0<strong>Create IoT Hub<\/strong>\u00a0from the menu.<img decoding=\"async\" class=\"alignnone size-full wp-image-1196\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/02\/create-iot-hub.png\" alt=\"\" width=\"490\" height=\"209\" \/><\/li>\n<li>Select Subscription, Resource Group and fill in other required fields to create IoT Hub<\/li>\n<\/ol>\n<h2><a id=\"user-content-register-an-iot-edge-device\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#register-an-iot-edge-device\"><\/a>Register an IoT Edge device<\/h2>\n<p>Register an IoT Edge device with your newly created IoT Hub.<\/p>\n<ol>\n<li>Select\u00a0<strong>&#8230;<\/strong>\u00a0then select\u00a0<strong>Create Edge device<\/strong>\u00a0from the menu.<img decoding=\"async\" class=\"alignnone size-full wp-image-1205\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/02\/create-edge-device.png\" alt=\"\" width=\"530\" height=\"208\" \/><\/li>\n<li>Type device id to create a new Edge device.<\/li>\n<\/ol>\n<h2><a id=\"user-content-configure-the-iot-edge-runtime\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#configure-the-iot-edge-runtime\"><\/a>Configure the IoT Edge runtime<\/h2>\n<p>Configure and start the Azure IoT Edge runtime on your device.<\/p>\n<ol>\n<li>Right-click the Edge device in Device List and select\u00a0<strong>Setup Edge<\/strong><img decoding=\"async\" class=\"alignnone size-full wp-image-1215\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/02\/setup-edge.png\" alt=\"\" width=\"435\" height=\"367\" \/><\/li>\n<li>In Command Palette, select\u00a0<strong>Edge: Start Edge<\/strong><\/li>\n<\/ol>\n<h2><a id=\"user-content-deploy-a-module\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#deploy-a-module\"><\/a>Deploy a module<\/h2>\n<p>Manage your Azure IoT Edge device in VS Code to deploy a module which will send telemetry data to IoT Hub.<\/p>\n<ol>\n<li>In Command Palette, select\u00a0<strong>Edge: Generate Edge deployment manifest<\/strong>, save the\u00a0<strong>deployment.json<\/strong>\u00a0file.<\/li>\n<li>In the\u00a0<strong>modules<\/strong>\u00a0section of\u00a0<strong>deployment.json<\/strong>, update\u00a0<strong>SampleModule<\/strong>\u00a0to\u00a0<strong>tempSensor<\/strong>, update\u00a0<strong><code>&lt;registry&gt;\/&lt;image&gt;:&lt;tag&gt;<\/code><\/strong>to\u00a0<strong>microsoft\/azureiotedge-simulated-temperature-sensor:1.0-preview<\/strong>.<\/li>\n<li>Right-click the Edge device in Device List and select\u00a0<strong>Create deployment for Edge device<\/strong>, then select the\u00a0<strong>deployment.json<\/strong>\u00a0file to deploy the module.<\/li>\n<\/ol>\n<h2><a id=\"user-content-view-generated-data\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#view-generated-data\"><\/a>View generated data<\/h2>\n<p>Monitor device to cloud messages sent from your IoT Edge device to your IoT hub<\/p>\n<ol>\n<li>To monitor data arriving at the IoT hub, right-click the Edge device and select\u00a0<strong>Start monitoring D2C message<\/strong><img decoding=\"async\" class=\"alignnone size-full wp-image-1225\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/02\/monitor-d2c-message.png\" alt=\"\" width=\"862\" height=\"369\" \/><\/li>\n<li>To stop monitoring data, right-click the Output Channel and select\u00a0<strong>Stop monitoring D2C message<\/strong><\/li>\n<\/ol>\n<h2><a id=\"user-content-view-module-stauts\" class=\"anchor\" href=\"https:\/\/github.com\/VSChina\/tutorial-simulate-device-vscode\/blob\/master\/tutorial-simulate-device-vscode.md#view-module-stauts\"><\/a>View module status<\/h2>\n<p>Expand the Edge device to view the status of each module<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1235\" src=\"https:\/\/devblogs.microsoft.com\/iotdev\/wp-content\/uploads\/sites\/24\/2018\/02\/module-status.png\" alt=\"\" width=\"309\" height=\"116\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>What&#8217;s Next<\/h2>\n<p>Now you have successfully deployed a pre-defined module on your IoT Edge device within Visual Studio Code. Besides that, you can build your own module as well. Please check out <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/iot-edge\/tutorial-csharp-module\">this tutorial<\/a> for developing and deploying your own module.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure IoT Edge enables you to perform analytics and data processing on your devices, instead of having to push all the data to the cloud. The IoT Edge tutorials demonstrate how to deploy different types of modules, built from Azure services or custom code, but first you need a device to test. In this tutorial [&hellip;]<\/p>\n","protected":false},"author":672,"featured_media":1836,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[7,20,33],"class_list":["post-1195","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-iot-dev","tag-azure-iot-hub","tag-iot-edge","tag-visual-studio-code"],"acf":[],"blog_post_summary":"<p>Azure IoT Edge enables you to perform analytics and data processing on your devices, instead of having to push all the data to the cloud. The IoT Edge tutorials demonstrate how to deploy different types of modules, built from Azure services or custom code, but first you need a device to test. In this tutorial [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts\/1195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/users\/672"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/comments?post=1195"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/posts\/1195\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/media\/1836"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/media?parent=1195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/categories?post=1195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/iotdev\/wp-json\/wp\/v2\/tags?post=1195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}