how do i integrate my data from azure functions to azure digital twins so that the data is reflected in the digital twins model?

Ho Kin Haw 25 Reputation points
2024-01-09T08:24:42.4033333+00:00

Hi,

I am having difficulty trying to get my sensor data reading to be reflected in my Azure Digital Twins model. I have already connected by sensor to Azure IoT explorer and published my Azure function but I'm not sure how to reflect the sensor data into my Digital Twins model. Could someone kindly assist me with this?

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
220 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,321 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
967 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 29,271 Reputation points MVP
    2024-01-09T18:53:04.7+00:00

    Hello @Ho Kin Haw,

    welcome to this moderated Azure community forum.

    I expect you created an Azure Digital Twins environment already and have a twin setup in the graph.

    To manipulate the digital twin properties in the graph, you need to execute specific code in an Azure Function (that has enough rights to manipulate twins).

    Take a look at this blog post with more details. Sample Azure Function code is available on GitHub.

    So, the flow is:

    device -> iothub -> Azure Function -> Azure Digital Twins environment

    Notice you need to update the properties of the twin. Azure Digital Twins also offers ingesting telemetry but this is a pass-through solution, generating ADT events but not changing the properties.

    Azure IoT Explorer is a tool to check for incoming messages on the IoT Hub and offers limited abilities to manipulate IoT Hub device registrations. This tool also has no role within the flow seen above.

    Also, notice that Azure Data Explorer is not part of this flow.

    Azure Data Explorer offers a historical view of ADT twin changes when connected as a database.

    In that case, the flow is:

    device -> iothub -> Azure Function -> Azure Digital Twins environment -> Azure Data Explorer table with historical events.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    1 person found this answer helpful.