Monitor your Azure IoT Hub

Why monitor?

Monitoring provides real‑time visibility into device connectivity, message flow, and health of your IoT solutions. It helps you detect anomalies, set alerts, and keep your services reliable.

Key Metrics

Connected Devices

Messages In (per minute)

Average Device Latency (ms)

Configure Alerts

Set up proactive alerts in Azure Monitor to be notified when thresholds are breached.

  1. Navigate to Azure Portal > IoT Hub > Alerts.
  2. Create a new alert rule and select a metric.
  3. Define the condition and action group (email, webhook, etc.).

Sample PowerShell script

Install-Module -Name Az.IotHub -Scope CurrentUser
Connect-AzAccount
$hub = Get-AzIotHub -ResourceGroup MyResourceGroup -Name MyIoTHub

# Get device telemetry count
$metrics = Get-AzMetric -ResourceId $hub.Id -MetricName "telemetryMessagesCount"
$metrics.Data | Format-Table Timestamp, Total