Skip to content

Commit 6e7cb16

Browse files
authored
Merge pull request #293193 from dominicbetts/iot-industrial-dynamics
IoT: Add Dynamics back to IIoT tutorial
2 parents 111f960 + d8bb3dd commit 6e7cb16

File tree

5 files changed

+93
-0
lines changed

5 files changed

+93
-0
lines changed
17.9 KB
Loading
26.4 KB
Loading
61.9 KB
Loading
8.24 KB
Loading

articles/iot/tutorial-iot-industrial-solution-architecture.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,99 @@ To create the Power BI dashboard, complete the following steps:
309309
310310
:::image type="content" source="media/concepts-iot-industrial-solution-architecture/power-bi.png" alt-text="Screenshot of a Power BI view." lightbox="media/concepts-iot-industrial-solution-architecture/power-bi.png" border="false" :::
311311
312+
## Connect the reference solution to Microsoft Dynamics 365 Field Service
313+
314+
This integration showcases the following scenarios:
315+
316+
- Upload assets from the manufacturing ontologies reference solution to Dynamics 365 Field Service.
317+
- Create alerts in Dynamics 365 Field Service when a certain threshold on manufacturing ontologies reference solution telemetry data is reached.
318+
319+
The integration uses Azure Logics Apps. With Logic Apps, you can use no-code workflows to connect business-critcal apps and services. This example shows you how to fetch data from Azure Data Explorer and trigger actions in Dynamics 365 Field Service.
320+
321+
If you're not already a Dynamics 365 Field Service customer, activate a [30 day trial](https://dynamics.microsoft.com/field-service/field-service-management-software/free-trial).
322+
323+
> [!TIP]
324+
> To avoid the need to configure cross tenant authentication, use the same Microsoft Entra ID that you used to deploy the manufacturing ontologies reference solution.
325+
326+
### Create an Azure Logic Apps workflow to create assets in Dynamics 365 Field Service
327+
328+
To upload assets from the manufacturing ontologies reference solution into Dynamics 365 Field Service:
329+
330+
1. Go to the Azure portal and create a new logic app resource.
331+
332+
1. Give the Azure Logic Apps a name, and place it in the same resource group as the manufacturing ontologies reference solution.
333+
334+
1. Select **Workflows**.
335+
336+
1. Give your workflow a name. For this scenario, use the stateful state type because assets aren't flows of data.
337+
338+
1. In the workflow designer, select **Add a trigger**. Create a **Recurrence** trigger to run every day. You can change the trigger to occur more frequently.
339+
340+
1. Add an action after the recurrence trigger. In **Add an action**, search for `Azure Data Explorer` and select the **Run KQL query** command. Leave the default authentication **OAuth**. Enter your Azure Data Explorer cluster URL and `ontologies` as the database name. In this query, you check what kind of assets you have. Use the following query to get assets from the manufacturing ontologies reference solution:
341+
342+
```kql
343+
opcua_telemetry
344+
| join kind=inner (
345+
opcua_metadata
346+
| distinct Name, DataSetWriterID
347+
| extend AssetList = split(Name, ';')
348+
| extend AssetName = tostring(AssetList[0])
349+
) on DataSetWriterID
350+
| project AssetName
351+
| summarize by AssetName
352+
```
353+
354+
1. To get your asset data into Dynamics 365 Field Service, you need to connect to Microsoft Dataverse. In **Add an action**, search for `Dataverse` and select the **Add a new row** command. Leave the default authentication **OAuth**. Connect to your Dynamics 365 Field Service instance and use the following configuration:
355+
356+
- In the **Table Name** field, select **Customer Assets**
357+
- In the **Name** field, select **Enter data from a previous step**, and the select **AssetName**.
358+
359+
:::image type="content" source="media/concepts-iot-industrial-solution-architecture/add-asset-name.png" alt-text="Screenshot of workflow designer that shows how to add the asset names to the table.":::
360+
361+
1. Save your workflow and run it. You can see the new assets are created in Dynamics 365 Field Service:
362+
363+
:::image type="content" source="media/concepts-iot-industrial-solution-architecture/dynamics-asset-table.png" alt-text="Screenshot that shows the new asset definitions in the field service asset table.":::
364+
365+
### Create an Azure Logic Apps workflow to create alerts in Dynamics 365 Field service
366+
367+
This workflow creates alerts in Dynamics 365 Field Service, when the `FaultyTime` for an asset in the manufacturing ontologies reference solution reaches a threshold.
368+
369+
1. To fetch the data, create an Azure Data Explorer function. In the Azure Data Explorer query panel in the Azure portal, run the following code to create a `FaultyFieldAssets` function in the **ontologies** database:
370+
371+
```kql
372+
.create-or-alter function FaultyFieldAssets() {
373+
let Lw_start = ago(3d);
374+
opcua_telemetry
375+
| where Name == 'FaultyTime'
376+
and Value > 0
377+
and Timestamp between (Lw_start .. now())
378+
| join kind=inner (
379+
opcua_metadata
380+
| extend AssetList =split (Name, ';')
381+
| extend AssetName=AssetList[0]
382+
) on DataSetWriterID
383+
| project AssetName, Name, Value, Timestamp}
384+
```
385+
386+
1. Create a new stateful workflow in your Logic App.
387+
388+
1. In the workflow designer, create a recurrence trigger that runs every three minutes. Then add an action and select the **Run KQL query** action.
389+
390+
1. Enter your Azure Data Explorer Cluster URL, then enter **ontologies** as the database name and use the `FaultyFieldAssets` function name as the query.
391+
392+
1. To get your asset data into Dynamics 365 Field Service, you need to connect to Microsoft Dataverse. In **Add an action**, search for `Dataverse` and select the **Add a new row** command. Leave the default authentication **OAuth**. Connect to your Dynamics 365 Field Service instance and use the following configuration:
393+
394+
- In the **Table Name** field, select **IoT Alerts**
395+
- In the **Description** field, use **Enter data from a previous step**, to build a message "**[AssetName]** has a **[Name]** of **[Value]**". **AssetName**, **Name**, and **Value** are the fields from the previous step.
396+
- In the **Alert Time** field, select **Enter data from a previous step**, and the select **Timestamp**.
397+
- In the **Alert Type** field, select **Anomaly**.
398+
399+
:::image type="content" source="media/concepts-iot-industrial-solution-architecture/add-alert-details.png" alt-text="Screenshot that shows the logic app configuration to create an alert.":::
400+
401+
1. Run the workflow and to see new alerts generated in your Dynamics 365 Field Service **IoT Alerts** dashboard:
402+
403+
:::image type="content" source="media/concepts-iot-industrial-solution-architecture/dynamics-iot-alerts.png" alt-text="Screenshot of alerts in Dynamics 365 FS." lightbox="media/concepts-iot-industrial-solution-architecture/dynamics-iot-alerts.png" border="false" :::
404+
312405
## Related content
313406
314407
- [Connect on-premises SAP systems to Azure](howto-connect-on-premises-sap-to-azure.md)

0 commit comments

Comments
 (0)