Device Twin Operations for IoT Hub Device Apps | Exam AZ-220

Which Device Twin Operations Are Available for IoT Hub Device Apps?

Question

You have several IoT devices connected to your IoT Hub.

You are designing the logic for your device applications that need to make certain operations on the corresponding device twins: Update reported properties Replace tags Retrieve tags Observe desired properties Replace desired properties Retrieve device twin Which of the above operations are available for device apps?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: C.

Option A is incorrect because the device app has no access to the tags section of the device twin.

Neither for reading, nor writing.

Option B is incorrect because the device app has no access to the tags section of the device twin.

Not even for querying.

Option C is CORRECT because the device app can retrieve the device twin document, can get notifications about the changing desired properties, and update the reported properties section in the device twin.

Option D is incorrect because these are all back-end operations available for services, not for device apps.

Reference:

In Microsoft Azure IoT Hub, device twins are used to maintain the state of devices that are connected to it. Each device that is connected to the IoT Hub has its own device twin, which is a JSON document that consists of two sections - desired properties and reported properties.

Reported properties are properties that the device application reports to the IoT Hub. Desired properties, on the other hand, are properties that the cloud application wants the device to have. Device apps can interact with the device twins in the following ways:

  1. Update reported properties: The device app can update the reported properties of the device twin. These properties are used to indicate the current state of the device to the cloud application. For example, if the device is a temperature sensor, it can report the current temperature value to the cloud application by updating the reported temperature property.

  2. Replace tags: The device app can replace the tags of the device twin. Tags are used to add metadata to the device twin. For example, if the device is a temperature sensor, the tag can be used to specify the location of the sensor.

  3. Retrieve tags: The device app can retrieve the tags of the device twin. This can be useful if the device app needs to access the metadata associated with the device twin.

  4. Observe desired properties: The device app can observe the desired properties of the device twin. This means that the device app can receive notifications whenever the cloud application updates the desired properties of the device twin.

  5. Replace desired properties: The device app can replace the desired properties of the device twin. This means that the device app can change the properties that the cloud application wants the device to have.

  6. Retrieve device twin: The device app can retrieve the entire device twin. This can be useful if the device app needs to access all the properties of the device twin.

Based on the above, the correct answer to the question is B. Device apps can perform the operations of updating reported properties, retrieving tags, observing desired properties, replacing desired properties, and retrieving the entire device twin.