Microsoft Azure IoT Developer Exam: Accessing Parts of Device Twin in an Office Building

Managing Device Twin Access in Azure IoT Hub

Question

You are designing the IoT solution of an office building where you would need 1000 devices registered in your IoT Hub.

Each device has its device twin, the content of which can be manipulated either from the back-end or from the device app itself.

However, the back-end and the device app have different rights when accessing different parts of the device twin.

Regarding the access to different parts of the device twin, which of the following statements are true?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: D.

Option A is incorrect because device apps don't have access (not even visibility) to the “tags” session in the device twin.

Option B is incorrect because “reported” properties are values to be updated by the device app.

Back-end has only read access to them.

Option C is incorrect because device twin tags can only be accessed (read and write) by the back-end application.

Device app has no visibility over tags.

Option D is CORRECT because desired properties are kind of instructions sent from the back-end to the device, while reported properties are values sent by the devices to the opposite direction.

Diagram:

Device app

Read, receive
change notifications

Read, write

Device twin

Tags

Properties

Desired

Reported

Back end

Read, write
change notifications

Read, write
change notifications

Read
change notifications

References:

The device twin in Azure IoT Hub is a JSON document that represents the state of a device. It contains two types of properties: desired properties and reported properties. Desired properties are set by the back-end application and represent the desired state of the device. Reported properties are updated by the device and represent the current state of the device.

In this scenario, there are 1000 devices registered in the IoT Hub, and each device has its own device twin. The content of the device twin can be manipulated from the back-end application or from the device app itself. However, there are different rights assigned to each of them for accessing different parts of the device twin. Let's go through each statement to see which ones are true:

A. Device app can retrieve the device twin id, tags, and properties; device gets notified of the changes in the desired properties. This statement is true. The device app can retrieve the device twin id, tags, and properties. Additionally, the device gets notified of the changes in the desired properties made by the back-end application. This allows the device to update its reported properties to reflect the desired state.

B. Device app can update the reported properties; Back-end can partially update reported properties. This statement is partially true. The device app can update the reported properties to reflect the current state of the device. However, the back-end application can also update the reported properties, but it can only do so partially. This means that the back-end application can update some of the reported properties, but not all of them.

C. Back-end can update device twin tags; Device app can partially update device twin tags. This statement is true. The back-end application can update the device twin tags to provide additional metadata about the device. The device app can also partially update the device twin tags, but it cannot update all of them.

D. Back-end can set desired properties; Device app can partially update reported properties. This statement is true. The back-end application can set the desired properties to represent the desired state of the device. The device app can partially update the reported properties to reflect the current state of the device.

In conclusion, statements A, C, and D are true, while statement B is partially true.