Query Azure Monitor Alerts task

Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018

Use this task in an agentless job of a release pipeline to observe the configured Azure monitor rules for active alerts.

Can be used in only an agentless job of a release pipeline.


In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.



YAML snippet

# Query Azure Monitor alerts
# Observe the configured Azure Monitor rules for active alerts
- task: AzureMonitor@1
    #filterType: 'none' # Options: resource, alertrule, none
    #resource: # Required when filterType == Resource
    #alertRule: # Required when filterType == Alertrule
    #severity: 'Sev0,Sev1,Sev2,Sev3,Sev4' # Optional. Options: sev0, sev1, sev2, sev3, sev4
    #timeRange: '1h' # Optional. Options: 1h, 1d, 7d, 30d
    #alertState: 'Acknowledged,New' # Optional. Options: new, acknowledged, closed
    #monitorCondition: 'Fired' # Optional. Options: fired , resolved


Parameter Comments
Azure subscription Required. Select an Azure Resource Manager service connection.
Resource group Required. The resource group being monitored in the subscription.
Resource type Required. Select the resource type in the selected group.
Resource name Required. Select the resources of the chosen types in the selected group.
Alert rules Required. Select from the currently configured alert rules to query for status.
Control options See Control options

Succeeds if none of the alert rules are activated at the time of sampling.

For more information about using this task, see Approvals and gates overview.

Also see this task on GitHub.