Cognitive Services

Filters

Actions

Example Policies

This set of policies will mark all Cognitive Services accounts for deletion in 7 days that have ‘test’ in name (ignore case), and then perform the delete operation on those ready for deletion.

policies:
  - name: mark-test-cogserv-for-deletion
    resource: azure.cognitiveservice
    filters:
      - type: value
        key: name
        op: in
        value_type: normalize
        value: test
     actions:
      - type: mark-for-op
        op: delete
        days: 7
  - name: delete-test-cogserv
    resource: azure.cognitiveservice
    filters:
      - type: marked-for-op
        op: delete
    actions:
      - type: delete

This policy will find all Cognitive Service accounts with 1000 or more total errors over the 72 hours and notify user@domain.com

policies:
  - name: notify-cogserv-many-failures
    resource: azure.cognitiveservice
    filters:
      - type: metric
        metric: TotalErrors
        op: ge
        aggregation: total
        threshold: 1000
        timeframe: 72
     actions:
      - type: notify
        template: default
        priority_header: 2
        subject: Cognitive Services with Errors
        to:
          - user@domain.com
        transport:
          - type: asq
            queue: https://accountname.queue.core.windows.net/queuename