Skip to content

Latest commit

 

History

History
93 lines (57 loc) · 6.14 KB

deploy-anomaly-detection-on-iot-edge.md

File metadata and controls

93 lines (57 loc) · 6.14 KB
title titleSuffix description author manager ms.service ms.topic ms.date ms.author
Run Anomaly Detector on IoT Edge
Azure AI services
Deploy the Anomaly Detector module to IoT Edge.
mrbullwinkle
nitinme
azure-ai-anomaly-detector
how-to
01/18/2024
mbullwin

Deploy an Anomaly Detector univariate module to IoT Edge

[!INCLUDE Deprecation announcement]

Learn how to deploy the Azure AI services Anomaly Detector module to an IoT Edge device. Once it's deployed into IoT Edge, the module runs in IoT Edge together with other modules as container instances. It exposes the exact same APIs as an Anomaly Detector container instance running in a standard docker container environment.

Prerequisites

[!INCLUDE Create an Azure AI Anomaly Detector resource]

Deploy the Anomaly Detection module to the edge

  1. In the Azure portal, enter Anomaly Detector on IoT Edge into the search and open the Azure Marketplace result.

  2. It will take you to the Azure portal's Target Devices for IoT Edge Module page. Provide the following required information.

    1. Select your subscription.

    2. Select your IoT Hub.

    3. Select Find device and find an IoT Edge device.

  3. Select the Create button.

  4. Select the AnomalyDetectoronIoTEdge module.

    :::image type="content" source="../media/deploy-anomaly-detection-on-iot-edge/iot-edge-modules.png" alt-text="Image of IoT Edge Modules user interface with AnomalyDetectoronIoTEdge link highlighted with a red box to indicate that this is the item to select.":::

  5. Navigate to Environment Variables and provide the following information.

    1. Keep the value accept for Eula.

    2. Fill out Billing with your Azure AI services endpoint.

    3. Fill out ApiKey with your Azure AI services API key.

    :::image type="content" source="../media/deploy-anomaly-detection-on-iot-edge/environment-variables.png" alt-text="Environment variables with red boxes around the areas that need values to be filled in for endpoint and API key":::

  6. Select Update

  7. Select Next: Routes to define your route. You define all messages from all modules to go to Azure IoT Hub. To learn how to declare a route, see Establish routes in IoT Edge.

  8. Select Next: Review + create. You can preview the JSON file that defines all the modules that get deployed to your IoT Edge device.

  9. Select Create to start the module deployment.

  10. After you complete module deployment, you'll go back to the IoT Edge page of your IoT hub. Select your device from the list of IoT Edge devices to see its details.

  11. Scroll down and see the modules listed. Check that the runtime status is running for your new module.

To troubleshoot the runtime status of your IoT Edge device, consult the troubleshooting guide.

Test Anomaly Detector on an IoT Edge device

You'll make an HTTP call to the Azure IoT Edge device that has the Azure AI services container running. The container provides REST-based endpoint APIs. Use the host, http://<your-edge-device-ipaddress>:5000, for module APIs.

Alternatively, you can create a module client by using the Anomaly Detector client library on the Azure IoT Edge device, and then call the running Azure AI services container on the edge. Use the host endpoint http://<your-edge-device-ipaddress>:5000 and leave the host key empty.

If your edge device does not already allow inbound communication on port 5000, you will need to create a new inbound port rule.

For an Azure VM, this can set under Virtual Machine > Settings > Networking > Inbound port rule > Add inbound port rule.

There are several ways to validate that the module is running. Locate the External IP address and exposed port of the edge device in question, and open your favorite web browser. Use the various request URLs below to validate the container is running. The example request URLs listed below are http://<your-edge-device-ipaddress:5000, but your specific container may vary. Keep in mind that you need to use your edge device's External IP address.

Request URL Purpose
http://<your-edge-device-ipaddress>:5000/ The container provides a home page.
http://<your-edge-device-ipaddress>:5000/status Also requested with GET, this verifies if the api-key used to start the container is valid without causing an endpoint query. This request can be used for Kubernetes liveness and readiness probes.
http://<your-edge-device-ipaddress>:5000/swagger The container provides a full set of documentation for the endpoints and a Try it out feature. With this feature, you can enter your settings into a web-based HTML form and make the query without having to write any code. After the query returns, an example CURL command is provided to demonstrate the HTTP headers and body format that's required.

Container's home page

Next steps