Hands-on Azure Digital Twins Read Online _best_ 〈QUICK ◎〉
"@id": "dtmi:handsOn:Zone;1", "@type": "Interface", "displayName": "Zone", "contents": [ "@type": "Property", "name": "temperature", "schema": "double", "writable": true , "@type": "Relationship", "name": "contains", "target": "dtmi:handsOn:Shelf;1" , "@type": "Relationship", "name": "hasSensor", "target": "dtmi:handsOn:Sensor;1" ]
The Problem: You have a building, a factory, or a logistics center. Sensors are streaming data, but the data is "dumb"—it’s just a timestamp and a number. A temperature of 22°C in isolation means nothing. hands-on azure digital twins read online
az dt twin create --adt-name adt-warehouse-<unique> --dtid "ZoneShipping" --dtmi "dtmi:handsOn:Zone;1" az dt twin create --adt-name adt-warehouse-<unique> --dtid "ShelfA" --dtmi "dtmi:handsOn:Shelf;1" Create sensors az dt twin create --adt-name adt-warehouse-<unique> --dtid "TempSensor-Rcv" --dtmi "dtmi:handsOn:Sensor;1" --properties '"sensorType":"temp"' Step 4: Build the Graph (Relationships) This is where the magic happens. Connect the twins. Think of it as a mini-Google Knowledge Graph
# Connect to ADT credential = DefaultAzureCredential() service_client = DigitalTwinsClient(credential, "https://adt-warehouse-<unique>.api.eus.digitaltwins.azure.net") \ --query-command "SELECT sensor
Your graph is now alive. Think of it as a mini-Google Knowledge Graph for your warehouse. Unlike SQL (tables) or NoSQL (documents), ADT uses a graph query language similar to SQL but with RELATED and IS_OF_MODEL . Query 1: Find all sensors in the Receiving Zone az dt twin query --adt-name adt-warehouse-<unique> \ --query-command "SELECT sensor FROM digitaltwins zone JOIN sensor RELATED zone.hasSensor WHERE zone.\$dtId = 'ZoneReceiving'" Result: Returns TempSensor-Rcv . Query 2: Traverse two hops (Warehouse → Zone → Sensor) az dt twin query --adt-name adt-warehouse-<unique> \ --query-command "SELECT sensor, zone FROM digitaltwins wh JOIN zone RELATED wh.contains JOIN sensor RELATED zone.hasSensor WHERE wh.\$dtId = 'WarehouseMain'" This is powerful. In a real app, this query would run in milliseconds, even across 100,000+ nodes. Step 6: Simulate Telemetry and Compute Changes Here’s where it gets truly hands-on. Azure Digital Twins itself does not ingest telemetry directly. Instead, you use Azure Functions or IoT Hub to route data in.