Understanding the components of Azure Digital Twins architecture
A Digital Twin Graph is created based on instances of those models and their relationships. The service provides several ways of managing the models and the Digital Twin Graph. But it depends on other Azure services to create an Azure Digital Twins instance.
In Figure 1.5, you see some of the Azure services available to interact with Azure Digital Twins. Some of these services can be used for different parts of your Azure Digital Twins instance.
Managing Azure Digital Twins
Managing is all about defining and creating models, creating instances of models, and laying out relationships between those instances to create a Digital Twins Graph. To access the Azure Digital Twins service, you have REST APIs available. The creation of models is done by defining the models using the DTLD. There are several ways of managing Azure Digital Twins:
- Azure Digital Twin Explorer – A tool to manage, view, and upload models, create instances of models, and set relationships.
- Client App – A custom application that makes use of available REST APIs and client SDKs to access the service.
- Power App – The Power Platform, a platform that provides several applications and services to build low-code/no-code solutions and allows you to create a Canvas app that can connect to an Azure Digital Twins service.
- Azure services – Different services such as Logic Apps, Azure Functions, and Azure Service Bus provide a way of connecting to Azure Digital Twins to manage the models. We will go into more depth about these services and how to use them in the next section.
Azure Functions
Azure Functions is a serverless compute service that runs event-triggered code. Azure Functions simplifies the development and provisioning of small applications without the concern of setting up an infrastructure. It is also called "compute on-demand." This means that it only runs when requested and automatically upscales when the number of requests increases.
Azure Functions makes it easy to handle different roles and tasks around an Azure Digital Twins instance. The following is a list of different tasks performed by Azure Functions.
Azure IoT Hub
This is a managed service that acts as a central messaging hub between devices and IoT applications such as the Azure Digital Twins service. Any device can be connected to Azure IoT Hub. The hub provides a secure way of communicating with the attached devices. It can route device telemetry to multiple endpoints. It integrates with other services, such as Azure Event Grid, Azure Logic Apps, Azure Machine Learning, and Azure Stream Analytics.
In production solutions, you will mostly rely on Azure IoT Hub as the hub for connecting your application against real-world IoT sensors.
Azure IoT Hub Device Provisioning Service
This service, also called DPS, is a provisioning service for Azure IoT Hub. It enables the provisioning and connection of millions of devices in a secure and scalable way to Azure IoT Hub – scenarios such as zero-touch provisioning, load-balancing, and connecting devices to different IoT solutions within your IoT platform.
Azure Logic Apps
Azure Logic Apps is an Azure service that allows you to build automated, scalable workflows. It incorporates the basic elements of the Azure platform, such as user roles, security, and more. It supports hundreds of connectors to connect to any Microsoft service or external well-known service in the cloud or on-premises. And if there is no connector available, you can directly call the service or create your own custom connector. It provides a visual web interface allowing you to build these workflows quickly. These workflows can then be integrated into applications such as your Azure Digital Twins instance.
Azure Logic Apps can be used to define processes around your instance. These processes will be able to create and update Digital Twins. Processes can act upon certain values that are read from the Digital Twins.
Azure Storage
In principle, a Digital Twin can store information in its properties. But as soon as new values are set, the old values are overwritten. Data can be preserved by connecting the Azure Digital Twins service to Azure Storage. Depending on your requirements, you could choose simple storage such as storage accounts. But in most cases, your Azure Digital Twins instance depends on IoT data. Azure Data Lake provides storage for these large amounts of data.
Azure Analytics
Azure Digital Twins is part of the IoT platform. In almost any Azure Digital Twins instance, IoT data is involved such as sensor data. The IoT platform provides several ways to perform analytics.
One of them is called Azure Time Series Insights Gen2. This is an open and scalable end-to-end IoT Analytics service. The service can be used for collecting, processing, storing, and querying IoT data to analyze trends and anomalies. It does not require any lines of code to use this service.
It provides APIs to integrate it into your solution. But it can also be integrated into the workflows defined around your solution.
Together with the Azure Digital Twins service, it can be used to monitor the health, usage, and performance of devices. This allows you to optimize operational efficiency.
Azure Service Bus
Azure Service Bus is cloud messaging as a service (MaaS). It simplifies cloud messaging on an enterprise level by delivering a scalable cloud messaging solution. The service acts as a message broker by using message queues and topics. When you built large IoT solutions including Azure Digital Twins, this service can support the routing of messages from IoT devices to a Digital Twin. Backend systems can be loosely coupled by using Azure Logic Apps. Azure Functions is used to get messages from the message queue into an Azure Digital Twins instance.