hiexam
microsoft · AZ-220 · Q748 · code_completion · azure, iot, azure_functions

HOTSPOT - You have an Azure IoT solution that uses Azure Digital Twins. You plan to ingest telemetry from an IoT devi…

HOTSPOT - You have an Azure IoT solution that uses Azure Digital Twins. You plan to ingest telemetry from an IoT device into a digital twin. You need to create an Azure function that will process the telemetry messages received by the Azure IoT hub and update the digital twin of the IoT device with the new values. How should you complete the code? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point. //IMG//
var cred = new DefaultAzureCredential();
var client = new DigitalTwinsClient(new Uri(adtInstanceUrl), cred);
if (egEvent != null && egEvent.Data != null) {
    JObject deviceMessage = (JObject)JsonConvert.DeserializeObject(egEvent.Data.ToString());
    string deviceId = (string)deviceMessage["systemProperties"]["iothub-connection-device-id"];
    var humidity = deviceMessage["body"]["Humidity"];
    var updateTwinData = new {{slot1}};
    updateTwinData.{{slot2}}("/Humidity", humidity.Value<double>());
    await client.UpdateDigitalTwinAsync(deviceId, updateTwinData);
}
Correct slot values

Answer hidden

Unlock AZ-220

First 5 questions of every exam are free. Unlock the rest.

Includes
  • · All — questions
  • · Verified answers + AI explanations
  • · Spaced-repetition mistake notebook
  • · Phone, tablet, laptop sync

One-time payment. Doesn't auto-renew. · Already paid? Sign in