Exercise - Deploy a pre-built module to the IoT Edge

Completed

To deploy the "Simulated Temperature Sensor" module from the Azure Marketplace, use the following steps:

  1. In the Azure portal, enter Simulated Temperature Sensor into the search and open the Marketplace result.

  2. Choose an IoT Edge device to receive this module. On the "Target Devices for IoT Edge Module" page, provide the following information:

    • Subscription: Select the subscription containing the IoT hub you're using
    • IoT Hub: Select the name of the IoT hub you're using
    • IoT Edge Device Name: As selected before
  3. Select Create.

  4. Using the three-step wizard, define precisely how to deploy the module.

    • Add Modules: The Simulated Temperature Sensor module should be autopopulated.
    • Specify Routes: Define how messages are passed between modules and to IoT Hub. If this setting isn't autopopulated to $upstream, add the following code:
    {
      "routes": {
        "route": "FROM /messages/* INTO $upstream"
      }
    }
    
    • Review Deployment: preview the deployment manifest JSON file that defines all the modules deployed to your IoT Edge device. Ensure it includes the "Simulated Temperature Sensor" module.
  5. Select your device from the list of IoT Edge devices to see its details.

    • On the device details page, scroll down to the Modules section.
    • Three modules should be listed: $edgeAgent, $edgeHub, and SimulatedTemperatureSensor. The list should look similar to the screenshot below.

    Important

    If a module is listed as "in deployment" but not reported by the device, your IoT Edge device is still starting it. Wait a few moments and click "Refresh" at the top of the page.

    Deployed modules at the edge.

  6. Open the command prompt on your IoT Edge device, or use the SSH connection from Azure CLI.

  7. Confirm that the module deployed from the cloud is running on your IoT Edge device using the sudo iotedge list command.

  8. View the messages being sent from the temperature sensor module using the command sudo iotedge logs SimulatedTemperatureSensor -f.

    Important

    Note that IoT Edge commands are case-sensitive when referring to module names.

  9. Clean up resources