(1) Navigate to your Azure IoT Hub and select "Diagnostic settings" from the Monitoring menu:
(2) Select + Add diagnostic setting
(3) Select the Categories "Connections" and the Destination details "Send to Log Analytics workspace". Give your new diagnostic setting a name and select "Save"
(1) Navigate to your Azure IoT Hub and select "Logs" from the Monitoring menu.
(2) Copy and paste the syntax below into the query window and select "Run"
// Connectivity errors // Identify device connection errors // To create an alert for this query, click '+ New alert rule' AzureDiagnostics | where ResourceProvider == "MICROSOFT.DEVICES" and ResourceType == "IOTHUBS" | where Category == "Connections" and Level == "Error" |
Errors would be returned for the device/client that included the following properties: