This is part of a 3 series blog, the first part can be found here.
In this section we will quickly deploy Remote Monitoring, this solution includes telemetry data and map data to display the performance of devices around the globe. Including whether they are health or have recently created alerts. The alert thresholds can also be set.
Go to https://www.azureiotsuite.com/ and deploy a new solution.
From the options select remote monitoring, make sure that you deploy to the same subscription in Azure where you deployed the Connect Field Service solution previously. The solution will deploy the following Azure resources:
- Azure IoT Hub (1 high-frequency unit)
- Azure Stream Analytics (3 streaming units)
- Azure DocumentDB (1 S2 instance)
- Azure Storage (1 GRS standard, 1 LRS standard, 1 RA-GRS standard)
- Azure App Services (2 S1 instances, 2 P1 instances)
- Azure Event Hub (1 basic throughput unit)
More information can be found here: https://social.technet.microsoft.com/wiki/contents/articles/32941.iot-suite-under-the-hood-remote-monitoring.aspx
This section we take the remote monitoring solution that is deployed in Azure and point it at the Connected Field Service solution. This will allow Remote Monitoring to read the data being sent to the CFS IoT Hub, which in turn means that you can have devices being monitored in Remote Monitoring and the same devices creating alerts in CFS!
Before pointing to the CFS IoT Hub, go into the remote monitoring solution and remove all the existing registered devices. Once the IoT Hub is changed it won't be possible to remove these.
This process is very simple, in the web app go to the application settings. There will be a number of 'App Settings' that can be changed. To repoint the IoT Hub change the iothub.Hostname & iothub.connectionstring to reference the IoT hub that was configured during the Connected Field Service deployment.
It is also possible to add the Bing maps API key here. If Remote Monitoring has been deployed before then by default there will be just be an image of a map until this key is updated. A free key can be got through the Azure subscription by searching for Bing in the resources.
There are 3 Stream Analytics Resources that make up the Remote Monitoring Solutions.
Each Stream is now using the wrong IoT Hub as an input so this needs to be changed for the solution to work. Step through each StreamAnalytic resource and change the input to be the CFS IoT Hub. To do this the StreamAnalytic Job must be stopped, it can then be restarted after the change.
It should now be possible to add a new device through the Remote Monitoring Dashboard. Within the dashboard the button in the bottom left allows for the adding of simulated or real devices. To test add a simulated device, this should create a device in the IoT Hub.
Instead of waiting for the temperature to go over 70 degrees based on the simulator it is possible to force its temperature using the simulator deployed in CFS in the 1st part of this blog.
When the first service alert appears in CFS it won't have a device associated with it. This is because Dynamics doesn't have a related device to that device ID, however this is easily resolved. Click into the IoT Alert, this should show the Device ID.
Now create a new device, it is critical that the same DeviceID is used. This ensures that rather than a new device being created the current record is associated with the already created device in IoT Hub. To complete this click the register device button on the ribbon.
It is also possible to add a customer asset, when doing this don't re-register the device, instead add the previously created device as a connection.
Taking these steps will mean that in the future any alerts will automatically show the associated customer, this means that service levels and entitlements can be applied to the case which is created by the device raising an alert.
Enhancing the solution
You now have a remote monitoring solution linked to CFS within Dynamics. This blog series will leave it here, however this setup can be enhanced. For example all of the following are easily within reach:-
- Point CFS at the Remote Monitoring device rules. This just involves editing the Azure Stream in CFS. The code exists in the RM solution.
- Putting a filter on Stream Analytics so alerts are only raised once. A real world device you can get a lot of alerts each time readings go over the threshold.
- Add a predictive algorithm. It is easy to add a web service to Stream Analytics, there are predictive models samples available such as Weather Prediction that use Humidity and Temperature. See here.
- Add a Power BI stream output so you can easily create custom visuals.
I hope that you have enjoyed this blog series and it has helped you get a better understanding of using Azure IoT with Dynamics. This capability is quick to get started on and can help companies reduce cost of their service departments.