An alert on failed runs
A metric alert on Failed pipeline runs, an action group that emails you, and a test with a pipeline made to fail.
A nightly pipeline fails at 02:00 and the first person to notice is someone opening an empty report at 09:00. Data Factory sends a metric for every failed pipeline run to Azure Monitor, and an alert rule on it can email you within minutes, without changing any pipeline.
The metric to watch
Data Factory reports Failed pipeline runs metrics (PipelineFailedRuns), a count per minute. It can be split by two dimensions: Name, the pipeline, and FailureType. Microsoft's own list of recommended alerts for Data Factory starts with exactly this rule: whenever the total is greater than 0.
Create the alert rule
In the Azure portal open your data factory, then Monitoring > Alerts > + Create > Alert rule. On Condition, pick the signal Failed pipeline runs metrics and set:
Aggregation type Total
Operator Greater than
Threshold value 0
Dimension Name all current and future values
Check every 5 minutes
Lookback period 5 minutesWith Name set to all values, a pipeline added next month is covered too. To alert only on the important pipelines, select their names instead.
An action group that emails you
On Actions choose Create action group. Give it a name such as ag-data-team, then on Notifications pick Email/SMS message/Push/Voice and enter your address, or a shared team mailbox so the alert does not depend on one person.
An action group can be reused by every alert rule, so the next rule only needs to pick it. Later it can also post to a webhook, an automation runbook or a Logic App.
Give the rule a clear name and severity, such as ADF failed runs and Sev 2, and create it.
Test it with a pipeline made to fail
Build a pipeline pl_fail_test with one Fail activity, which ends a run with a message and an error code you choose:
Fail message Test failure for the alert rule
Error code 500Publish it and run it with Add trigger > Trigger now, the way scheduled pipelines run. Within a few minutes the email arrives with the rule's name, the data factory and the time window. In Monitor > Alerts in the portal the alert shows as Fired, and once no new failures happen it resolves on its own.
What it does not tell you
The email says that a pipeline failed, not why. For the error message in the email the next lesson calls a Logic App from the pipeline; for patterns over weeks, the last lesson reads the run history in Log Analytics.