Device provisioning status not updating in aziotc visualization dashboard after DPS enrollment

Our custom visualization dashboard shows devices as ‘pending’ even after successful DPS enrollment and IoT Hub assignment. We’re polling the DPS API every 60 seconds but the dashboard status doesn’t reflect actual device activation.

DPS enrollment completes successfully (verified in Azure portal), devices connect to IoT Hub and send telemetry, but our dashboard still shows them as pending for hours. We’re using DPS REST API v2021-10-01:

response = requests.get(
    f"https://{dps_name}.azure-devices-provisioning.net/enrollments/{enrollment_id}",
    headers={"Authorization": f"Bearer {token}"}
)
status = response.json().get("provisioningStatus")

The API version compatibility seems fine based on docs, but wondering if there’s a DPS event integration we should be using instead of polling. Dashboard polling interval of 60s should be sufficient, but are we missing something about how DPS communicates device activation status?

Polling DPS for status updates isn’t the recommended approach. You should be using Event Grid integration to receive real-time notifications when devices complete provisioning. The polling approach has inherent delays and may miss status transitions.

That makes sense - we’re querying the wrong endpoint. So we should be querying IoT Hub device registry instead of DPS enrollment status? But how do we know which hub the device was assigned to without querying DPS first?

You need a two-step approach: query DPS to get the assigned hub, then query that hub’s device registry for status. But this is inefficient for dashboards. Event Grid is definitely the way to go for real-time updates.

The issue is that you’re checking the enrollment status, not the registration status. These are different entities in DPS. After a device provisions, the enrollment remains in ‘enabled’ state, but you need to query the device registration status from the assigned IoT Hub to get the actual activation state. The DPS API won’t show you post-provisioning device status - that’s tracked in IoT Hub’s device registry.