ActivityLog Alerts and ActionGroups

This commit is contained in:
Duke Kamstra 2017-03-29 14:02:08 -07:00
Родитель d51b166e31
Коммит f7e75b66f1
6 изменённых файлов: 610 добавлений и 15 удалений

Просмотреть файл

@ -180,6 +180,8 @@
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/virtualMachines"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/virtualMachineScaleSets"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/extensions"},
{ "$ref": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups" },
{ "$ref": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActivityLogAlert.json#/resourceDefinitions/activitylogalerts" },
{ "$ref": "#/definitions/resourceGeneric" }
]
}

Просмотреть файл

@ -135,13 +135,13 @@
{ "$ref": "http://schema.management.azure.com/schemas/2015-12-01/Microsoft.Batch.json#/resourceDefinitions/batchAccounts_applications" },
{ "$ref": "http://schema.management.azure.com/schemas/2015-12-01/Microsoft.Batch.json#/resourceDefinitions/batchAccounts_applications_versions" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-01/Microsoft.Cache.json#/resourceDefinitions/Redis" },
{ "$ref": "http://schema.management.azure.com/schemas/2015-02-01-preview/Microsoft.Logic.json#/resourceDefinitions/workflows"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-06-01/Microsoft.Logic.json#/resourceDefinitions/workflows"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-03-01/Microsoft.Scheduler.json#/resourceDefinitions/jobCollections"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-03-01/Microsoft.Scheduler.json#/resourceDefinitions/jobCollections_jobs"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-05-01-preview/Microsoft.MachineLearning.json#/resourceDefinitions/webServices"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-05-01-preview/Microsoft.MachineLearning.json#/resourceDefinitions/commitmentPlans"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-01/Microsoft.MachineLearning.json#/resourceDefinitions/workspaces"},
{ "$ref": "http://schema.management.azure.com/schemas/2015-02-01-preview/Microsoft.Logic.json#/resourceDefinitions/workflows" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-06-01/Microsoft.Logic.json#/resourceDefinitions/workflows" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-03-01/Microsoft.Scheduler.json#/resourceDefinitions/jobCollections" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-03-01/Microsoft.Scheduler.json#/resourceDefinitions/jobCollections_jobs" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-05-01-preview/Microsoft.MachineLearning.json#/resourceDefinitions/webServices" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-05-01-preview/Microsoft.MachineLearning.json#/resourceDefinitions/commitmentPlans" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-01/Microsoft.MachineLearning.json#/resourceDefinitions/workspaces" },
{ "$ref": "http://schema.management.azure.com/schemas/2015-10-31/Microsoft.Automation.json#/resourceDefinitions/automationAccounts" },
{ "$ref": "http://schema.management.azure.com/schemas/2015-10-31/Microsoft.Automation.json#/resourceDefinitions/runbooks" },
{ "$ref": "http://schema.management.azure.com/schemas/2015-10-31/Microsoft.Automation.json#/resourceDefinitions/modules" },
@ -170,14 +170,16 @@
{ "$ref": "http://schema.management.azure.com/schemas/2016-09-01/Microsoft.Authorization.json#/resourceDefinitions/locks" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-09-01/Microsoft.Resources.json#/resourceDefinitions/deployments" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-07-07/Microsoft.ApiManagement.json#/resourceDefinitions/service" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/disks"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/snapshots"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/images"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/availabilitySets"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/virtualMachines"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/virtualMachineScaleSets"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/extensions"},
{ "$ref": "http://schema.management.azure.com/schemas/2016-06-27-preview/Microsoft.ContainerRegistry.json#/resourceDefinitions/registries"}
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/disks" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/snapshots" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/images" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/availabilitySets" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/virtualMachines" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/virtualMachineScaleSets" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-04-30-preview/Microsoft.Compute.json#/resourceDefinitions/extensions" },
{ "$ref": "http://schema.management.azure.com/schemas/2016-06-27-preview/Microsoft.ContainerRegistry.json#/resourceDefinitions/registries" },
{ "$ref": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups" },
{ "$ref": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActivityLogAlert.json#/resourceDefinitions/activitylogalerts" }
]
}
]

Просмотреть файл

@ -0,0 +1,172 @@
{
"id": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Microsoft.Insights",
"description": "microsoft insights Resource Types",
"resourceDefinitions": {
"actionGroups": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Insights/actionGroups"
]
},
"apiVersion": {
"type": "string",
"enum": [
"2017-03-01-preview"
]
},
"properties": {
"oneOf": [
{
"$ref": "#/definitions/ActionGroup"
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
},
"required": [
"type",
"apiVersion",
"properties"
],
"description": "Microsoft.Insights/actionGroups"
}
},
"definitions": {
"ActionGroup": {
"type": "object",
"properties": {
"groupShortName": {
"type": "string",
"description": "The short name of the action group. This will be used in SMS messages."
},
"enabled": {
"oneOf": [
{
"type": "boolean",
"enum": [
"true"
]
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "Indicates whether this action group is enabled. If an action group is not enabled, then none of its receviers will receive communications."
},
"emailReceivers": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/EmailReceiver"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The list of email receivers that are part of this action group."
},
"smsReceivers": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/SmsReceiver"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The list of SMS receivers that are part of this action group."
},
"webhookReceivers": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/WebhookReceiver"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The list of webhook receivers that are part of this action group."
}
},
"required": [
"groupShortName",
"enabled"
],
"description": "An Azure action group."
},
"EmailReceiver": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the email receiver. Names must be unique across all receivers within an action group."
},
"emailAddress": {
"type": "string",
"description": "The email address of this receiver."
}
},
"required": [
"name",
"emailAddress"
],
"description": "An email receiver."
},
"SmsReceiver": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the SMS receiver. Names must be unique across all receivers within an action group."
},
"countryCode": {
"type": "string",
"description": "The country code of the SMS receiver."
},
"phoneNumber": {
"type": "string",
"description": "The phone number of the SMS receiver."
}
},
"required": [
"name",
"countryCode",
"phoneNumber"
],
"description": "An SMS receiver."
},
"WebhookReceiver": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the webhook receiver. Names must be unique across all receivers within an action group."
},
"serviceUri": {
"type": "string",
"description": "The URI where webhooks should be sent."
}
},
"required": [
"name",
"serviceUri"
],
"description": "A webhook receiver."
}
}
}

Просмотреть файл

@ -0,0 +1,199 @@
{
"id": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActivityLogAlert.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Microsoft.Insights Activity Log Alerts",
"description": "Microsoft Insights Types",
"resourceDefinitions": {
"activityLogAlerts": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Microsoft.Insights/activitylogalerts"
]
},
"apiVersion": {
"type": "string",
"enum": [
"2017-03-01-preview"
]
},
"properties": {
"oneOf": [
{
"$ref": "#/definitions/ActivityLogAlert"
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
]
}
},
"required": [
"type",
"apiVersion",
"properties"
],
"description": "Microsoft.Insights/activitylogalerts"
}
},
"definitions": {
"ActivityLogAlert": {
"type": "object",
"properties": {
"scopes": {
"oneOf": [
{
"type": "string",
"items": {
"type": "string"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The list of scopes"
},
"enabled": {
"oneOf": [
{
"type": "boolean",
"enum": [
"true"
]
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"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."
},
"condition": {
"oneOf": [
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
},
{
"$ref": "/definitions/ActivityLogAlertAllOfCondition"
}
],
"description": "The conditon that will cause this alert to activate."
},
"actions": {
"oneOf": [
{
"$ref": "#/definitions/ActivityLogAlertActionList"
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The actions that will activate when the condition is met."
},
"description": {
"type": "string",
"minLength": 1,
"description": "A description of this activity log alert."
}
},
"required": [
"scopes",
"enabled",
"condition",
"actions"
],
"description": "An Azure Activity log alert."
},
"ActivityLogAlertActionGroup": {
"type": "object",
"properties": {
"actionGroupId": {
"type": "string",
"description": "The resourceId of the action group."
},
"webhookPropertios": {
"oneOf": [
{
"type": "object",
"additionalProperties": {
"type": "string"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload."
}
},
"required": [
"actionGroupId"
],
"description": "A pointer to an Azure Action Group."
},
"ActivityLogAlertActionList": {
"type": "object",
"properties": {
"actionGroups": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/ActivityLogAlertActionGroup"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The list of activity log alerts."
}
},
"description": "A list of activity log alert actions."
},
"ActivityLogAlertAllOfCondition": {
"type": "object",
"properties": {
"allOf": {
"oneOf": [
{
"type": "array",
"items": {
"$ref": "#/definitions/ActivityLogAlertLeafCondition"
}
},
{
"$ref": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#/definitions/expression"
}
],
"description": "The list of activity log alert conditions."
}
},
"required": [
"allOf"
],
"description": "An Activity Log alert condition that is met when all its member conditions are met."
},
"ActivityLogAlertLeafCondition": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "The name of the field that this condition will examine."
},
"equals": {
"type": "string",
"description": "The field value that will meet the condition."
}
},
"required": [
"field",
"equals"
],
"description": "An Activity Log alert condition that is met by comparing an activity log field and value."
}
}
}

Просмотреть файл

@ -0,0 +1,144 @@
{
"tests": [
{
"name": "Action Group Test - SMS Only",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups",
"json": {
"type": "Microsoft.Insights/actionGroups",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Action Group - SMS only",
"properties": {
"groupShortName": "SMSOnly",
"enabled": true,
"smsReceivers": [
{
"name": "contosoSMS",
"countryCode": "1",
"phoneNumber": "5555551212"
}
]
}
}
},
{
"name": "Action Group Test - Email Only",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups",
"json": {
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Action Group - Email only",
"properties": {
"groupShortName": "EmailOnly",
"enabled": true,
"emailReceivers": [
{
"name": "contosoEmail",
"emailAddress": "devops@contoso.com"
}
]
}
}
},
{
"name": "Action Group Test - Webhook Only",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups",
"json": {
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Action Group - Webhook only",
"properties": {
"groupShortName": "WebhookOnly",
"enabled": true,
"webhookReceivers": [
{
"name": "contosoHook",
"serviceUri": "http://requestb.in/1bq62iu1"
}
]
}
}
},
{
"name": "Action Group Test - One of each",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups",
"json": {
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Action Group - All action types",
"properties": {
"groupShortName": "AllTypes",
"enabled": true,
"smsReceivers": [
{
"name": "contosoSMS",
"countryCode": "1",
"phoneNumber": "5555551212"
}
],
"emailReceivers": [
{
"name": "contosoEmail",
"emailAddress": "devops@contoso.com"
}
],
"webhookReceivers": [
{
"name": "contosoHook",
"serviceUri": "http://requestb.in/1bq62iu1"
}
]
}
}
},
{
"name": "Action Group Test - Two of each",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActionGroup.json#/resourceDefinitions/actiongroups",
"json": {
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Action Group - Two of each action type",
"properties": {
"groupShortName": "TwoOfEach",
"enabled": true,
"smsReceivers": [
{
"name": "contosoSMS",
"countryCode": "1",
"phoneNumber": "5555551212"
},
{
"name": "contosoSMS2",
"countryCode": "1",
"phoneNumber": "5555552121"
}
],
"emailReceivers": [
{
"name": "contosoEmail",
"emailAddress": "devops@contoso.com"
},
{
"name": "contosoEmail2",
"emailAddress": "devops2@contoso.com"
}
],
"webhookReceivers": [
{
"name": "contosoHook",
"serviceUri": "http://requestb.in/1bq62iu1"
},
{
"name": "contosoHook2",
"serviceUri": "http://requestb.in/1bq62iu2"
}
]
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,76 @@
{
"tests": [
{
"name": "Activity Log Alert - Administrative",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActivityLogAlert.json#/resourceDefinitions/activitylogalerts",
"json": {
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST Administrative Activity Log Alert",
"properties": {
"scopes": [
"/subscriptions/52c65f65-0518-4d37-9719-7dbbfc68c57a"
],
"description": "This is a silly description",
"enabled": true,
"condition": {
"allOf": [
{
"field": "category",
"equals": "Administrative"
},
{
"field": "resourceGroup",
"equals": "TEST-RG"
},
{
"field": "caller",
"equals": "devops@contoso.com"
}
]
},
"actions": {
"actionGroups": [
{
"actionGroupId": "/subscriptions/52c65f65-0518-4d37-9719-7dbbfc68c57a/resourceGroups/CONTOSO-TEST/providers/Microsoft.Insights/actionGroups/ContosoIncidentActions"
}
]
}
}
}
},
{
"name": "Activity Log Alert - Service Health",
"definition": "http://schema.management.azure.com/schemas/2017-03-01-preview/Microsoft.Insights.ActivityLogAlert.json#/resourceDefinitions/activitylogalerts",
"json": {
"type": "Microsoft.Insights/activityLogAlerts",
"apiVersion": "2017-03-01-preview",
"location": "Global",
"name": "TEST ServiceHealth Activity Log Alert",
"properties": {
"scopes": [
"/subscriptions/52c65f65-0518-4d37-9719-7dbbfc68c57a"
],
"description": "This is a silly description",
"enabled": true,
"condition": {
"allOf": [
{
"field": "category",
"equals": "ServiceHealth"
}
]
},
"actions": {
"actionGroups": [
{
"actionGroupId": "/subscriptions/52c65f65-0518-4d37-9719-7dbbfc68c57a/resourceGroups/CONTOSO-TEST/providers/Microsoft.Insights/actionGroups/ContosoIncidentActions"
}
]
}
}
}
}
]
}