Simplify building automated workflows and apps powered by Azure Digital Twins
Published Mar 21 2023 09:00 AM 6,116 Views
Microsoft

As you create digital models of your physical world, you need a simple and seamless way to incorporate your digital models into your business applications. This allows you to gain faster insights and drive better business outcomes.

 

Azure Digital Twins is a powerful way to contextualize your data by creating twin graphs based on digital models of your physical world. Microsoft Power Platform is an extensible platform of low-code tools that makes it easy to create flows using Power Automate and apps using Power Apps. Together, Microsoft Power Platform and Azure Digital Twins allow you to build powerful workflows and apps that incorporate Azure Digital Twins into your business workflows and applications.    

 

Azure Digital Twins connector

 

The connector is a wrapper around the Azure Digital Twins data plane APIs, and provides a simpler way to make these API calls as prebuilt actions in Power Automate and Azure Logic Apps, and as functions in Power Apps. You can also integrate the Azure Digital Twins connector with 700 other Power Platform connectors, to build flows or apps by ingesting from other systems into digital twins or responding to events. Additionally, you can use the Azure Digital Twins connector to build your flows in Azure Logic Aps. This article shows how to create a recurring workflow in Power Automate that adds digital twins and a relationship between them to your Azure Digital Twins instance.

 

1.jpg

 

Prerequisites

 

 

Step 1: Create a data connection to Azure Digital Twins from Power Automate

  1. Sign into your Power Automate environment and go to Data > Connections.
  2. Select + New Connection and search for Azure Digital Twins.
  3. Select Azure Digital Twins and provide the Azure Digital Twins instance’s host name.
  4. Select Create to complete the data connection.

2.jpg

 

Step 2: Create Power Automate flow

  1. In the left menu, go to My flows and select + New Flow.
  2. Pick Scheduled cloud flow and provide details such as name and a time schedule to run this flow.
  3. Select + New step and in the search connector box, search for Azure Digital Twins.
  4. Select the Azure Digital Twins connector and select the Add Twin action.

3.jpg

 

  1. Add a Twin with a digital twin ID of Floor10, and the following request body. To learn more about adding the request body for Add Twin, see the API reference page.

 

{
    "$metadata": {
        "$model": "dtmi:example:Floor;1"
    }
}

 

 

  1. Select + Next step, and repeat steps 3 and 4 of this section to add another twin with a digital twin ID of RoomA, and the following request body.

 

{
     "$metadata": {
     "$model": "dtmi:example:Room;1"
      }
 }

 

 

  1. Select + Next step. Using the Azure Digital Twin connector, add the Add Relationship action with a digital twin ID of Floor10, a relationship ID of contains, and the following request body.

 

{
  "$targetId": "RoomA",
  "$relationshipName": "contains"
}

 

  1. Select Save and then select Test.
  2. Run the test flow manually by selecting Test and then Run flow.
  3. Ensure you successfully ran the test.

4.jpg

 

Step 3: Verify the digital twin graph in the Azure Digital Twins Explorer

  1. Navigate to your Azure Digital Twins instance in the Azure portal.
  2. Select Open Azure Digital Twins Explorer.
  3. In the Query Explorer, select Run Query and verify that the twins and their relationship have been added.

5.jpg

 

To learn more about the Azure Digital Twins connector, visit the documentation or the connector reference page.

Co-Authors
Version history
Last update:
‎Mar 21 2023 02:19 PM
Updated by: