Activity Log Alerts - List By Subscription Id

Get a list of all Activity Log Alert rules in a subscription.

GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts?api-version=2020-10-01

URI Parameters

Name In Required Type Description
subscriptionId
path True
  • string

The ID of the target subscription.

api-version
query True
  • string

The API version to use for this operation.

Responses

Name Type Description
200 OK

The request succeeded.

Other Status Codes

An error occurred and the list of Activity Log Alert rules could not be retrieved.

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get list of all Activity Log Alert rules under a subscription

Sample Request

GET https://management.azure.com/subscriptions/187f412d-1758-44d9-b052-169e2564721d/providers/Microsoft.Insights/activityLogAlerts?api-version=2020-10-01

Sample Response

{
  "value": [
    {
      "id": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1",
      "type": "Microsoft.Insights/ActivityLogAlerts",
      "name": "SampleActivityLogAlertRule1",
      "location": "Global",
      "tags": {},
      "properties": {
        "scopes": [
          "subscriptions/187f412d-1758-44d9-b052-169e2564721d"
        ],
        "condition": {
          "allOf": [
            {
              "field": "category",
              "equals": "Administrative"
            },
            {
              "field": "level",
              "equals": "Error"
            }
          ]
        },
        "actions": {
          "actionGroups": [
            {
              "actionGroupId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/actionGroups/SampleActionGroup",
              "webhookProperties": {
                "sampleWebhookProperty": "SamplePropertyValue"
              }
            }
          ]
        },
        "enabled": true,
        "description": "Description of sample Activity Log Alert rule."
      }
    },
    {
      "id": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2",
      "type": "Microsoft.Insights/ActivityLogAlerts",
      "name": "SampleActivityLogAlertRule2",
      "location": "Global",
      "tags": {},
      "properties": {
        "scopes": [
          "subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2"
        ],
        "condition": {
          "allOf": [
            {
              "field": "category",
              "equals": "Administrative"
            },
            {
              "field": "status",
              "equals": "Succeeded"
            }
          ]
        },
        "actions": {
          "actionGroups": [
            {
              "actionGroupId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup",
              "webhookProperties": {}
            }
          ]
        },
        "enabled": true,
        "description": "Description of sample Activity Log Alert rule."
      }
    }
  ]
}

Definitions

ActionGroup

A pointer to an Azure Action Group.

ActionList

A list of Activity Log Alert rule actions.

ActivityLogAlertResource

An Activity Log Alert rule resource.

AlertRuleAllOfCondition

An Activity Log Alert rule condition that is met when all its member conditions are met.

AlertRuleAnyOfOrLeafCondition

An Activity Log Alert rule condition that is met when all its member conditions are met. Each condition can be of one of the following types: Important: Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition.

  • Leaf Condition - must contain 'field' and either 'equals' or 'containsAny'. Please note, 'anyOf' should not be set in a Leaf Condition.
  • AnyOf Condition - must contain only 'anyOf' (which is an array of Leaf Conditions). Please note, 'field', 'equals' and 'containsAny' should not be set in an AnyOf Condition.
AlertRuleLeafCondition

An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. This condition must contain 'field' and either 'equals' or 'containsAny'.

AlertRuleList

A list of Activity Log Alert rules.

ErrorResponse

The error response.

ActionGroup

A pointer to an Azure Action Group.

Name Type Description
actionGroupId
  • string

The resource ID of the Action Group. This cannot be null or empty.

webhookProperties
  • object

the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.

ActionList

A list of Activity Log Alert rule actions.

Name Type Description
actionGroups

The list of the Action Groups.

ActivityLogAlertResource

An Activity Log Alert rule resource.

Name Type Description
id
  • string

The resource Id.

location
  • string

The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always be 'global'.

name
  • string

The name of the resource.

properties.actions

The actions that will activate when the condition is met.

properties.condition

The condition that will cause this alert to activate.

properties.description
  • string

A description of this Activity Log Alert rule.

properties.enabled
  • boolean

Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated.

properties.scopes
  • string[]

A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one item.

tags
  • object

The tags of the resource.

type
  • string

The type of the resource.

AlertRuleAllOfCondition

An Activity Log Alert rule condition that is met when all its member conditions are met.

Name Type Description
allOf

The list of Activity Log Alert rule conditions.

AlertRuleAnyOfOrLeafCondition

An Activity Log Alert rule condition that is met when all its member conditions are met. Each condition can be of one of the following types: Important: Each type has its unique subset of properties. Properties from different types CANNOT exist in one condition.

  • Leaf Condition - must contain 'field' and either 'equals' or 'containsAny'. Please note, 'anyOf' should not be set in a Leaf Condition.
  • AnyOf Condition - must contain only 'anyOf' (which is an array of Leaf Conditions). Please note, 'field', 'equals' and 'containsAny' should not be set in an AnyOf Condition.
Name Type Description
anyOf

An Activity Log Alert rule 'anyOf' condition.
An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met.

containsAny
  • string[]

The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met.

equals
  • string

The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met.

field
  • string

The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'.

AlertRuleLeafCondition

An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. This condition must contain 'field' and either 'equals' or 'containsAny'.

Name Type Description
containsAny
  • string[]

The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition is met.

equals
  • string

The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met.

field
  • string

The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'.

AlertRuleList

A list of Activity Log Alert rules.

Name Type Description
nextLink
  • string

Provides the link to retrieve the next set of elements.

value

The list of Activity Log Alert rules.

ErrorResponse

The error response.

Name Type Description
code
  • string

The error code.

message
  • string

The error message indicating why the operation failed.