Azure Trigger

Azure Trigger

Certified

Trigger flows from Azure Monitor metrics

Polls Azure Monitor metrics on a schedule and starts an execution when the query returns datapoints. Interval defaults to 60s. Requires regional endpoint.

yaml
type: io.kestra.plugin.azure.monitoring.Trigger

Trigger when Azure Monitor metric query returns non-empty results

yaml
id: azure_monitor_trigger
namespace: company.team

tasks:
  - id: each
    type: io.kestra.plugin.core.flow.Loop
    values: "{{ trigger.results }}"
    tasks:
      - id: log
        type: io.kestra.plugin.core.log.Log
        message: "Datapoint: {{ fromJson(item.value) }}"

triggers:
  - id: watch
    type: io.kestra.plugin.azure.monitoring.Trigger
    interval: "PT1M"
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    endpoint: "https://westeurope.metrics.monitor.azure.com"
    resourceIds:
      - "/subscriptions/xxx/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1"
    metricNames:
      - "Percentage CPU"
    metricsNamespace: "Microsoft.Compute/virtualMachines"
    window: PT5M
    aggregations:
      - "Average"

Trigger when CPU exceeds threshold with filter

yaml
id: azure_monitor_cpu_alert
namespace: company.team

tasks:
  - id: alert
    type: io.kestra.plugin.core.log.Log
    message: "High CPU detected: {{ trigger.datapoints }} datapoints"

triggers:
  - id: watch_cpu
    type: io.kestra.plugin.azure.monitoring.Trigger
    interval: "PT5M"
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    endpoint: "https://westeurope.metrics.monitor.azure.com"
    resourceIds:
      - "/subscriptions/xxx/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm1"
      - "/subscriptions/xxx/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/vm2"
    metricNames:
      - "Percentage CPU"
    metricsNamespace: "Microsoft.Compute/virtualMachines"
    window: PT5M
    aggregations:
      - "Average"
    filter: "Average gt 80"
Properties

Azure Monitor endpoint

SubTypestring

Aggregations to apply

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Azure client id

Azure client secret

Filter expression

Granularity of the returned metrics

DefaultPT1M
Formatduration

Interval between polling.

The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.

SubTypestring

Metric names to query

Metrics namespace

Order by expression

SubTypestring

Resource ids to query metrics for

Dimension to roll up by

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Azure subscription id

Azure tenant id

Maximum number of records to return

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

DefaultPT5M

Time window to query over

Total number of datapoints fetched across all metrics and resources

Total number of unique metrics fetched across all resources

Total number of resources queried

SubTypeobject

List of metrics results