# Retrieving Device Twin information from Microsoft Azure IoT Hub

With Microsoft Azure IoT Hub, Device Twins are JSON documents that contain information about a device e. g. its configuration or condition. You can retrieve this information and inject it into a flow.

1. The device must be registered with Microsoft Azure IoT Hub.
2. The controller must be connected to the internet.

1. Open Node-RED.
2. Add the following nodes to the workspace and connect them to a flow:
3. inject node from the input category
4. Azure IoT Hub Device Twin node from the cloud category
5. debug node from the output category
6. Double-click the inject node to open the Edit node dialogue.
7. In the text box Payload, enter the desired device ID as string.
8. Click Done to apply your changes.
9. Double-click the Azure IoT Hub Device Twin node to open the Edit node dialogue.
10. In the text box connectionString, enter the IoT Hub connection string.
11. Click Done to apply your changes.
12. Click Deploy.
13. Click the button on the left side of the inject node.
14. The inject node triggers the retrieval of the Device Twin information. The Device Twin information is displayed in the debug tab of the sidebar.

## NOTICE

You can replace both the inject node and the debug node with any node, you want to use to retrieve and process the Device Twin information.

Registering a device with Microsoft Azure IoT Hub