An introduction to the Microsoft Azure Digital Twin service

An introduction to the Microsoft Azure Digital Twin service

Digital Twin? That’s a buzzword for something isn’t it? Could be. But it is actually an interesting type of service which allows you as an IT company explain a business solution to your customers without going into depth about Machine Learning, Mixed Reality, Internet of Things, Sensory data and many other technologies. It is a business solution which can easily solve several use cases for your customer. And they aren’t particularly interested in what technologies you would need to use, as long as it does the job.

What is a Digital Twin?

So what is a Digital Twin? A Digital Twin is a digital representation, also called a copy, of physical entity(s) in the real world. A physical entity can be anything from people, places, machines, factories, devices, systems and even processes. One of the characteristics of a Digital Twin is that the replica represents a, if possible a true, copy of one or more actual physical entities. Such a copy is visualized using a 2D form like a web browser or a 3D form using for example a Microsoft HoloLens device or mobile device supporting augmented reality. These physical entities generate real-time data which is feed back into the model of the Digital Twin. In some cases a Digital Twin is compared to concepts like cross-reality environments and mirror models.

The idea is creating a “living” simulation model. The model continuous update and change based on the actual values of real–life entities. Such a simulation model can be used in several different use-cases. Use cases for example

  • Simulation – Simulate different scenarios which you normally never would do an the actual asset without damaging it or causing collateral damages.
  • Analyse & Optimize – optimize systems, machines or processes by tweaking values in the simulation model. This allows you to see the effect on those entities without changing the actual configuration. When a better and more optimized configuration is found it can be applied to the actual real-life entities.
  • Training – simulation models allow you to train new personnel without using the actual machine or control room. Some scenarios You could also use it in education at schools
  • Testing – use the simulation model to find the utter edges of the system before it fails.
  • Visualization – get more and clearer insights in current statuses of systems and machine over multiple locations spread.
  • Complex models – Bring complex scenarios with lots of sensory devices divided over structured locations into a single model. Combine and use the data to create easy and simple to understand views.
  • Professional services – Use sensory data from devices at different locations to provide services to your company. The Microsoft example which is available for Digital Twin is a great example. In this example different types of sensory data, temperature, movement and other, is used to determine if a room is available and suited for you.

You can understand that there are far more examples in which a Digital Twin can offer benefits.

Microsoft Azure Digital Twin Service

The Azure Digital Twin service is an IoT service which helps you in creating models of physical environments. It uses something called a spatial intelligence graph. The spatial intelligence graph allows you to model a structure of relationships and interactions between people, places and devices. This allows you to query real-time data from devices which are bound into a structured environment instead of a single device without any relationships whatsoever. The service is part of Azure and supports high scalability and re-usability so called “spatially aware experiences”. With other words duplicating real-time experiences around assets (e.g. machines, processes or other) into a model which knows where exactly the data from sensory devices is coming from. More information can be found here.

Keep in mind that Azure Digital Twin service does not deliver a complete Digital Twin solution. It still requires to connect to sensory devices using for example a IoT Hub. That means you will need to setup a IoT Hub. You also need to think about how you want to visualize and interact with your model. Where are you going to output the results? And how do you want to visualize the structured model of people, places and device. So what does Azure Digital Twin service offer? It offers

  • Modelling the relationships and interactions between people, places and devices using the spatial intelligence graph
  • Use of predefined and domain specific object models
  • Secure scalability and reuse for multiple tenants
  • Custom functions which can be used for changing incoming data or executing checks against incoming data from sensory devices
  • Automation of device tasks using advanced Azure compute capabilities.

Using the Azure Digital Twin service

Azure Digital Twin is at the moment of writing in preview. it is even extremely difficult to get a service installed via the Azure portal since Microsoft has limited the number of instances allowed per region. Meaning that you will need to wait till someone removes a Azure Digital Twin service from his tenant before you can add one yourself. Hopefully this will be resolved as quickly as possible with more availability or when Azure Digital Twin goes into general availability.

Microsoft has an extensive amount of documentation about how to implement Azure Digital Twins. There are concepts, references and resources available in the following documentation.

There is an interesting tutorial about monitoring a building with a Azure Digital Twin. This is the Microsoft example i spoke earlier about. The tutorial helps you to configure and deploy a already made solution into your Azure Digital Twin service. The first two steps of the tutorial are the most important one. They are roughly laid out below.

  • Deploy the Azure Digital Twin service by creating a new resource in your Azure portal.
  • Create an app registration to access the Azure Digital Twin REST API
  • Grant the right permissions to the app registration
  • Download the sample code. It consists of two projects. One is used to configure and provision a spatial intelligence graph. The second one is used to simulate devices and sensory data
  • Configure and provision a spatial intelligence graph
  • Define conditions to monitor
  • Create an user-defined function
  • Simulate device and sensory data using the second project
  • Run the simulation data
  • Run the building service to see if there is a room available based on the current sensory data

The tutorial is thorough and self explaining. Therefor i’m not going to explain each step. You will to follow the following tutorial.

There were some things which require a little bit more attention. Those things i will mention here.

You are building an application which will access the Azure Digital Twin Service through the Azure Digital Twin API. This requires to have an app registration in Azure Active Directory which is given read/write permissions to the Azure Digital Twin service. This requires to have administrative rights in your Azure portal. To get it to work i had to specify an additional platform in the app registration under [Your app registration] > Authentication > Add platform. Add the mobile and desktop applications platform. Make sure you add a redirect URI called http://localhost:8080/. In a later stadium you will be changing the appSettings.json file. That configuration file contains a AARedirectURi defined with the same URI.

Based on some organization settings you will require to have administrative consent. You will need to add delegated permissions for read/write access to Azure Digital Twin. Make sure that the Azure Digital Twin permission appears correctly in the list. If not, then use “Grant admin consent for organization” to give the admin consent.

Keep in mind that the demo uses a simulation sample which simulates sensor data and send that to the IoT Hub which is provisioned by the Azure Digital Twin service. No actual devices and sensors are used in the example.

Azure Digital Twin pricing

The Azure Digital Twin service has no upfront costs or termination fees. You only pay per node and message.

A node is a single component in the spatial intelligence graph. Below the Microsoft example showing a Digital Twin for sensory devices in rooms in a building.

Each Tenant, building, floor, room, device and sensor in this Microsoft demo is a node.

Each API call to the Azure Digital Twin API counts for a message. Each communication sent to a device and sensor are counted as message. And messages send from the Azure Digital Twin to other systems count. You can get discounts when using the service extensively. More information about pricing can be found here.


Azure Digital Twin is a useful tool to build Digital Twin solutions for customers. It is mainly self explanatory when using the different use-cases without going to much into technical detail. Azure Digital Twin service delivers an important part of storing the spatial intelligence graph which is a replication of your real world environment. The tutorial is a great example in how to use the Azure Digital Twin Service in combination with simulated IoT data.