connectionStateUpdatedTime key-value pair is missing in IOT Hub device twin

terrifficsvs 1 Reputation point
2021-10-26T11:42:15.663+00:00

Hi

As per the documentation
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-identity-registry#:~:text=and%20child%20relationships.-,status,For%20this%20reason%2C%20it%20shouldn%27t%20be%20used%20in%20production%20scenarios.,-Note

connectionStateUpdatedTime is missing in our iot hub device twin in azure portal, but the same appears as a microsoft device explorer app dashboard column when clicked on device management option. Can you please let us know why it is not displaying as part of device twin json

Regards
Pavan

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,127 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Matthijs van der Veer 4,376 Reputation points MVP
    2021-10-26T20:37:44.68+00:00

    Hi there,
    The connectionStateUpdatedTime is not part of the device twin, but it is part of the device identity. These two entities have overlapping properties (for instance ConnectionState/LastActivityTime/Status), but connectionStateUpdatedTime is exclusive to the device identity.

    You can retrieve the device identity using the CLI:

    az iot hub device-identity show --device-id TestDevice -n iot-hub-name  
    

    SDK (C# example):

    var registryManager = RegistryManager.CreateFromConnectionString("connectionString");  
    var device = await registryManager.GetDeviceAsync("TestDevice");  
    

    Or the REST API (source):

    https://fully-qualified-iothubname.azure-devices.net/devices/TestDevice?api-version=2020-05-31-preview  
    
    2 people found this answer helpful.
    0 comments No comments