Azure Digital Twins Fusing digital and physical world with Azure Digital Twins

When talking about IoT solutions, think of devices generating data that we can analyze. Some sensors measure temperature or pressure. Others measure humidity and carbon dioxide level. All this data needs to be collected and processed. This creates a great opportunity to predict future trends, patterns or anomalies, like a machine overheating.

Key points
  • What is Azure Digital Twins?
  • What are its key concepts?
  • How to integrate IoT devices with Azure Digital Twins?
  • What are some use cases for the service?

A function that can visualize physical environments and associated devices will help us make better use of this information. Microsoft just happens to offer such a service. They call it Azure Digital Twins.

What is Azure Digital Twins?

Azure Digital Twins is an Azure IoT service that enables comprehensive virtual representations of physical environments and associated devices, sensors, and people. You can think of it as a service that lets you create definitions of spaces and combine them together with information about connected devices and sensors.

How about an example? You can define the location of offices at your place of business. Inside each office there are IoT devices with specific sensors (e.g. temperature). Now you can assign users to each room, so you have a clear view of the distribution of people in the office.

The image below shows a high-level concept of Azure Digital Twins:

Azure Digital Twins high-level concept

Azure Digital Twins high-level concept (click to view full size)

How can we use Azure Digital Twins with IoT devices?

As I mentioned before, the key concept of Azure Digital Twins is to create a virtual representation of spaces together with information about connected devices and sensors. When defining your setup, it is crucial to provide all these details.

Spatial graphs

When there are, say, two IoT devices with temperature sensors in three specific rooms in the office, it is important to recreate this mapping in the Azure Digital Twins spatial graph. Spatial graphs are virtual representations of the many relationships between spaces, devices, and people that are relevant to a specific IoT solution.

There are four main categories of objects in spatial graphs:

  • Spaces  virtual or physical locations like an office
  • Devices  virtual or physical pieces of equipment like an Azure Sphere board with connected sensors
  • Sensors  objects that detect events, for instance a temperature sensor connected to an Azure Sphere board
  • Users  identified occupants and their characteristics.

All of the above objects can have defined relationships with each other, with the end goal being a clear view of all spaces, devices connected to them and the people involved.


Going further, you can define actions based on data from specific sensors. For instance, if the temperature in a specific room is too high, there can be an e-mail sent to the office administrator to prompt them to adjust HVAC settings for that area.

This is possible because of another object in Azure Digital Twins called User-defined functions (UDFs) can perform the following actions:

  • Send notifications when predefined conditions are met  like an e-mail message
  • Perform custom logic based on sensor readings and set the output for the relevant space
  • Attach some metadata to specific spaces.

Underneath, Azure Digital Twins uses the IoT Hub service, which is why it is much easier to integrate IoT devices with it.

If you are not familiar with the IoT Hub service, I encourage you to read one of my previous articles called Microsoft Azure Services For The Internet Of Things, where I cover a few of the key Azure services for the Internet of Things.

Sample code

I’ve included a fragment of code definition for a spatial graph:

– name: Predica Office
type: Venue
– type: IoTHub
– name: Floor 0
type: Floor
– name: Conference Room 1
type: Room
subType: ConferenceRoom
– name: AzureSphere
hardwareId: AzureSphere1
– dataType: Temperature

The following diagram presents the data flow and processing in Azure Digital Twins:

Azure Digital Twins data flow and processing diagram

Azure Digital Twins data flow and processing diagram (click to view full size)

What are some real use cases for Azure Digital Twins?

The main question is: How can we use Azure Digital Twins in application? Let’s go over some examples.

Monitor office availability

If you work in an office, you are probably aware of the constant challenges with meeting room availability. You are constantly trying to find free space to have a call with a customer or to organize a meeting with your team, but all the rooms are either booked in the calendar, or randomly occupied by people. If there are many meeting rooms in your office, it would be nice to quickly check availability in real-time. Azure Digital Twins can help.

There can be a motion sensor mounted in the each room, connected to Azure Digital Twins. Now, finding a free room in real time would be much easier.

Manage your fleet of vehicles

Next, consider an organization with a large fleet of vehicles. Managing it is not an easy task.

Finding an available car or localizing it could be much easier with Azure Digital Twins. Each vehicle could have a GPS device which sends information about its position to the service.

Going further, there could be an application with a map to show the available vehicles, as well as those that are already on the road, assigned to specific employees.

Monitor your home

The term “smart home” is not new to the market. You can use Azure Digital Twins to also build “smart home” solutions.

If each room had a mounted IoT device with specific sensors (like temperature or humidity), an owner of that house you could have a mobile application that shows all the readings in one place.

I encourage you to watch a short video which shows how Azure Digital Twins can be useful in hotel management:

Azure Digital Twins as a part of the solution for predictive maintenance

As described earlier in the article, Azure Digital Twins enables physical environment mapping using IoT devices. I mentioned some use cases above but we can look at the Digital Twins from from a wider perspective. There are many possible use cases, lets discuss few of them:


Imagine that you are the owner of the hotel. You would like to have knowledge about parts in each room, that should be repaired or serviced, like a radiator or air conditioning.


As a restaurant owner you would like to measure power usage of some electronic devices in the kitchen so you can replace them with more efficient ones.

Manufacturing plant

Managing manufacturing plant and predicting usage of some parts is not an easy task. It would be great to have information that some parts of the machines will broke soon so it is time to replace them in time.

It would be nice to automate the process related with creating tickets in your CRM, in this case Dynamics 365, to plan some actions like scheduling the meeting with person from service team. All these scenarios can be addressed with the Azure IoT service called Connected Field Service for Dynamics 365. Connected Field Service is an add-on solution to Microsoft Dynamics 365 for Field Service that connects IoT (Internet of Things) telemetry to business actions (like reporting that radiator is broken). Below diagram presents sample architecture for predictive maintenance solution:

With such solution you have not only the knowledge about exact place where intervention is required (thanks to Azure Digital Twins) but also automatic report in the Dynamics 365 so right people can solve all these problems quickly.


IoT solutions can be complex, so it is much easier to build them with existing cloud services like Azure Digital Twins. In this article I showcased a few key concepts related to this service.

Now you know that in a spatial graph there are four main object categories: spaces, devices, sensors and users. Based on data collected from IoT sensors, there can be actions performed. These are called User-defined functions (UDFs) and they include functionality like sending notifications or performing some additional, custom logic. We covered a few real-world scenarios.

Sign up for Predica Newsletter

A weekly, ad-free newsletter that helps cutomer stay in the know. Take a look.

Smart buildings with Azure Digital Twins and Custom Vision

At the time of writing this article, the Azure Digital Twins service is in the preview stage. Hopefully, Microsoft will announce the final version soon. In the meantime, feel free to get in touch for more information!

Key takeaways
  1. Azure Digital Twins is an Azure IoT service that enables comprehensive virtual representations of physical environments and associated devices, sensors, and people.
  2. A spatial graph is a virtual representation of the many relationships between spaces, devices, and people that are relevant to an IoT solution.
  3. Azure Digital Twins uses the IoT Hub service.
  4. It is possible to visualize and analyze events from Azure Digital Twins spaces using Time Series Insights.

Ready to learn more about us?


Want more updates like this? Join thousands of specialists who already follow our newsletter.

Stay up to date with the latest cloud insights from our CTO