Azure / Azure/azure-powershell

How to add an alert to the IoT hub?

Open
#2,807 5 comments 0 reactions 2 assignees Assigned to @liadtal View on GitHub
act-observability-squad customer-reported Monitor - Alerts Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

Hi guys,

I am trying to add an alert rule to the IoT hub via powershell by executing:

Add-AzureRMMetricAlertRule -Name test -Location "West Europe" -ResourceGroup $rg `
-Operator GreaterThan -Threshold 2 -WindowSize 00:05:00`
-TargetResourceId /subscriptions/[my id here]/resourceGroups/[my rg here]/providers/Microsoft.Devices/IotHubs/[iothub name here] `
-MetricName "c2d.commands.egress.reject.success" -Description "Test Alert" -TimeAggre Total

But it returns **InvalidArgument: The property 'resourceId' has an invalid value**. I can't add the alert via Azure portal as well because the button is hidden (Operation monitoring enabled).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.