swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  title: Azure Activity Log Alerts
  version: 2017-03-01-preview
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-ms-code-generation-settings:
    name: MonitorManagementClient
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-03-01-preview/activityLogAlerts_API.json
      version: "2.0"
  x-preferred: false
  x-providerName: azure.com
  x-serviceName: monitor-activityLogAlerts_API
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  ActivityLogAlertNameParameter:
    description: The name of the activity log alert.
    in: path
    name: activityLogAlertName
    required: true
    type: string
    x-ms-parameter-location: method
  ApiVersionParameter:
    description: Client Api Version.
    in: query
    name: api-version
    required: true
    type: string
  ResourceGroupNameParameter:
    description: The name of the resource group.
    in: path
    name: resourceGroupName
    required: true
    type: string
    x-ms-parameter-location: method
  SubscriptionIdParameter:
    description: The Azure subscription Id.
    in: path
    name: subscriptionId
    required: true
    type: string
paths:
  "/subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts":
    get:
      deprecated: true
      description: Get a list of all activity log alerts in a subscription.
      operationId: ActivityLogAlerts_ListBySubscriptionId
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: The request succeeded.
          schema:
            $ref: "#/definitions/ActivityLogAlertList"
        default:
          description: An error occurred and the list of activity log alerts could not be retrieved.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        List activity log alerts:
          parameters:
            api-version: 2017-03-01-preview
            resourceGroupName: Default-ActivityLogAlerts
            subscriptionId: 187f412d-1758-44d9-b052-169e2564721d
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert
                    location: Global
                    name: SampleActivityLogAlert
                    properties:
                      actions:
                        actionGroups:
                          - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                            webhookProperties:
                              sampleWebhookProperty: samplePropertyValue
                      condition:
                        allOf:
                          - equals: Administrative
                            field: Category
                          - equals: Error
                            field: Level
                      description: Sample activity log alert description
                      enabled: true
                      scopes:
                        - subscriptions/187f412d-1758-44d9-b052-169e2564721d
                    tags: {}
                    type: Microsoft.Insights/ActivityLogAlerts
                  - id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert2
                    location: Global
                    name: SampleActivityLogAlert2
                    properties:
                      actions:
                        actionGroups:
                          - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                            webhookProperties: {}
                      condition:
                        allOf:
                          - equals: Administrative
                            field: Category
                      enabled: true
                      scopes:
                        - subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts
                    tags: {}
                    type: Microsoft.Insights/ActivityLogAlerts
              headers: {}
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts":
    get:
      deprecated: true
      description: Get a list of all activity log alerts in a resource group.
      operationId: ActivityLogAlerts_ListByResourceGroup
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: The request succeeded.
          schema:
            $ref: "#/definitions/ActivityLogAlertList"
        default:
          description: An error occurred and the list of activity log alerts could not be retrieved.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        List activity log alerts:
          parameters:
            api-version: 2017-03-01-preview
            resourceGroupName: Default-ActivityLogAlerts
            subscriptionId: 187f412d-1758-44d9-b052-169e2564721d
          responses:
            "200":
              body:
                value:
                  - id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert
                    location: Global
                    name: SampleActivityLogAlert
                    properties:
                      actions:
                        actionGroups:
                          - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                            webhookProperties:
                              sampleWebhookProperty: samplePropertyValue
                      condition:
                        allOf:
                          - equals: Administrative
                            field: Category
                          - equals: Error
                            field: Level
                      description: Sample activity log alert description
                      enabled: true
                      scopes:
                        - subscriptions/187f412d-1758-44d9-b052-169e2564721d
                    tags: {}
                    type: Microsoft.Insights/ActivityLogAlerts
                  - id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert2
                    location: Global
                    name: SampleActivityLogAlert2
                    properties:
                      actions:
                        actionGroups:
                          - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                            webhookProperties: {}
                      condition:
                        allOf:
                          - equals: Administrative
                            field: Category
                      enabled: true
                      scopes:
                        - subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts
                    tags: {}
                    type: Microsoft.Insights/ActivityLogAlerts
              headers: {}
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}":
    delete:
      deprecated: true
      description: Delete an activity log alert.
      operationId: ActivityLogAlerts_Delete
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ActivityLogAlertNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: The activity log alert was successfully deleted.
        "204":
          description: The activity log alert does not exist. It may have already been deleted.
        default:
          description: An error occurred and the activity log alert could not be deleted.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Delete an activity log alert:
          parameters:
            activityLogAlertName: SampleActivityLogAlert
            api-version: 2017-03-01-preview
            resourceGroupName: Default-ActivityLogAlerts
            subscriptionId: 187f412d-1758-44d9-b052-169e2564721d
          responses:
            "200": {}
            "204": {}
    get:
      deprecated: true
      description: Get an activity log alert.
      operationId: ActivityLogAlerts_Get
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ActivityLogAlertNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
      responses:
        "200":
          description: The request succeeded.
          schema:
            $ref: "#/definitions/ActivityLogAlertResource"
        default:
          description: An error occurred and the activity log alert could not be retrieved.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Get an activity log alert:
          parameters:
            activityLogAlertName: SampleActivityLogAlert
            api-version: 2017-03-01-preview
            resourceGroupName: Default-ActivityLogAlerts
            subscriptionId: 187f412d-1758-44d9-b052-169e2564721d
          responses:
            "200":
              body:
                id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert
                location: Global
                name: SampleActivityLogAlert
                properties:
                  actions:
                    actionGroups:
                      - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                        webhookProperties:
                          sampleWebhookProperty: samplePropertyValue
                  condition:
                    allOf:
                      - equals: Administrative
                        field: Category
                      - equals: Error
                        field: Level
                  description: Sample activity log alert description
                  enabled: true
                  scopes:
                    - subscriptions/187f412d-1758-44d9-b052-169e2564721d
                tags: {}
                type: Microsoft.Insights/ActivityLogAlerts
              headers: {}
    patch:
      deprecated: true
      description: Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method.
      operationId: ActivityLogAlerts_Update
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ActivityLogAlertNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: Parameters supplied to the operation.
          in: body
          name: activityLogAlertPatch
          required: true
          schema:
            $ref: "#/definitions/ActivityLogAlertResourcePatch"
      responses:
        "200":
          description: An existing activity log alert was successfully updated.
          schema:
            $ref: "#/definitions/ActivityLogAlertResource"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Path an activity log alert:
          parameters:
            activityLogAlertName: SampleActivityLogAlert
            activityLogAlertPatch:
              location: Global
              properties:
                enabled: false
              tags:
                key1: value1
                key2: value2
            api-version: 2017-03-01-preview
            resourceGroupName: Default-ActivityLogAlerts
            subscriptionId: 187f412d-1758-44d9-b052-169e2564721d
          responses:
            "200":
              body:
                id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert
                location: Global
                name: SampleActivityLogAlert
                properties:
                  actions:
                    actionGroups:
                      - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                        webhookProperties:
                          sampleWebhookProperty: samplePropertyValue
                  condition:
                    allOf:
                      - equals: Administrative
                        field: Category
                      - equals: Error
                        field: Level
                  description: Sample activity log alert description
                  enabled: false
                  scopes:
                    - /subscriptions/187f412d-1758-44d9-b052-169e2564721d
                tags:
                  key1: value1
                  key2: value2
                type: Microsoft.Insights/ActivityLogAlerts
              headers: {}
    put:
      deprecated: true
      description: Create a new activity log alert or update an existing one.
      operationId: ActivityLogAlerts_CreateOrUpdate
      parameters:
        - $ref: "#/parameters/SubscriptionIdParameter"
        - $ref: "#/parameters/ResourceGroupNameParameter"
        - $ref: "#/parameters/ActivityLogAlertNameParameter"
        - $ref: "#/parameters/ApiVersionParameter"
        - description: The activity log alert to create or use for the update.
          in: body
          name: activityLogAlert
          required: true
          schema:
            $ref: "#/definitions/ActivityLogAlertResource"
      responses:
        "200":
          description: An existing activity log alert was successfully updated.
          schema:
            $ref: "#/definitions/ActivityLogAlertResource"
        "201":
          description: A new activity log alert was successfully created.
          schema:
            $ref: "#/definitions/ActivityLogAlertResource"
        default:
          description: An error occurred and the activity log alert could not be created or updated.
          schema:
            $ref: "#/definitions/ErrorResponse"
      x-ms-examples:
        Create or update an activity log alert:
          parameters:
            activityLogAlert:
              location: Global
              properties:
                actions:
                  actionGroups:
                    - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                      webhookProperties:
                        sampleWebhookProperty: samplePropertyValue
                condition:
                  allOf:
                    - equals: Administrative
                      field: Category
                    - equals: Error
                      field: Level
                description: Sample activity log alert description
                enabled: true
                scopes:
                  - /subscriptions/187f412d-1758-44d9-b052-169e2564721d
              tags: {}
            activityLogAlertName: SampleActivityLogAlert
            api-version: 2017-03-01-preview
            resourceGroupName: Default-ActivityLogAlerts
            subscriptionId: 187f412d-1758-44d9-b052-169e2564721d
          responses:
            "200":
              body:
                id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActivityLogAlerts/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert
                location: Global
                name: SampleActivityLogAlert
                properties:
                  actions:
                    actionGroups:
                      - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                        webhookProperties:
                          sampleWebhookProperty: samplePropertyValue
                  condition:
                    allOf:
                      - equals: Administrative
                        field: Category
                      - equals: Error
                        field: Level
                  description: Sample activity log alert description
                  enabled: true
                  scopes:
                    - /subscriptions/187f412d-1758-44d9-b052-169e2564721d
                tags: {}
                type: Microsoft.Insights/ActivityLogAlerts
              headers: {}
            "201":
              body:
                id: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlert
                location: Global
                name: SampleActivityLogAlert
                properties:
                  actions:
                    actionGroups:
                      - actionGroupId: /subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup
                        webhookProperties:
                          sampleWebhookProperty: samplePropertyValue
                  condition:
                    allOf:
                      - equals: Administrative
                        field: Category
                      - equals: Error
                        field: Level
                  description: Sample activity log alert description
                  enabled: true
                  scopes:
                    - subscriptions/187f412d-1758-44d9-b052-169e2564721d
                tags: {}
                type: Microsoft.Insights/ActivityLogAlerts
              headers: {}
definitions:
  ActivityLogAlert:
    description: An Azure activity log alert.
    properties:
      actions:
        $ref: "#/definitions/ActivityLogAlertActionList"
        description: The actions that will activate when the condition is met.
      condition:
        $ref: "#/definitions/ActivityLogAlertAllOfCondition"
        description: The condition that will cause this alert to activate.
      description:
        description: A description of this activity log alert.
        type: string
      enabled:
        default: true
        description: Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated.
        type: boolean
      scopes:
        description: A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item.
        items:
          type: string
        type: array
    required:
      - scopes
      - condition
      - actions
  ActivityLogAlertActionGroup:
    description: A pointer to an Azure Action Group.
    properties:
      actionGroupId:
        description: The resourceId of the action group. This cannot be null or empty.
        type: string
      webhookProperties:
        additionalProperties:
          type: string
        description: The dictionary of custom properties to include with the post operation. These data are appended to the webhook payload.
    required:
      - actionGroupId
  ActivityLogAlertActionList:
    description: A list of activity log alert actions.
    properties:
      actionGroups:
        description: The list of activity log alerts.
        items:
          $ref: "#/definitions/ActivityLogAlertActionGroup"
        type: array
  ActivityLogAlertAllOfCondition:
    description: An Activity Log alert condition that is met when all its member conditions are met.
    properties:
      allOf:
        description: The list of activity log alert conditions.
        items:
          $ref: "#/definitions/ActivityLogAlertLeafCondition"
        type: array
    required:
      - allOf
  ActivityLogAlertLeafCondition:
    description: An Activity Log alert condition that is met by comparing an activity log field and value.
    properties:
      equals:
        description: The field value will be compared to this value (case-insensitive) to determine if the condition is met.
        type: string
      field:
        description: "The name of the 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.'."
        type: string
    required:
      - field
      - equals
  ActivityLogAlertList:
    description: A list of activity log alerts.
    properties:
      value:
        description: The list of activity log alerts.
        items:
          $ref: "#/definitions/ActivityLogAlertResource"
        type: array
  ActivityLogAlertPatch:
    description: An Azure activity log alert for patch operations.
    properties:
      enabled:
        default: true
        description: Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated.
        type: boolean
  ActivityLogAlertResource:
    allOf:
      - $ref: "#/definitions/Resource"
    description: An activity log alert resource.
    properties:
      properties:
        $ref: "#/definitions/ActivityLogAlert"
        x-ms-client-flatten: true
  ActivityLogAlertResourcePatch:
    allOf:
      - $ref: "#/definitions/Resource"
    description: An activity log alert resource for patch operations.
    properties:
      properties:
        $ref: "#/definitions/ActivityLogAlertPatch"
        x-ms-client-flatten: true
  ErrorResponse:
    description: Describes the format of Error response.
    properties:
      code:
        description: Error code
        type: string
      message:
        description: Error message indicating why the operation failed.
        type: string
    type: object
  Resource:
    description: An azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        type: string
      location:
        description: Resource location
        type: string
        x-ms-mutability:
          - create
          - read
      name:
        description: Azure resource name
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: Resource tags
      type:
        description: Azure resource type
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
