Skip to main content

alerts

Creates, updates, deletes, gets or lists an alerts resource.

Overview

Namealerts
TypeResource
Idazure.alerts_management.alerts

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
contextobjectInformation specific to the monitor service that gives more contextual details about the alert.
customPropertiesobjectCustom properties that can hold any user defined key-value pairs.
egressConfigobjectConfig which would be used for displaying the data in portal.
essentialsobjectThis object contains consistent fields across different monitor services.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_idselectscope, alert_idGet a specific alert. Get information related to a specific alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/{alertId}' and 'vm1' is deleted then if you want to get alert by id then use parent resource of scope. So in this example get alert by id call will look like this: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AlertsManagement/alerts/{alertId}'.
get_summaryselectscope, groupbyincludeSmartGroupsCount, targetResource, targetResourceType, targetResourceGroup, monitorService, monitorCondition, severity, alertState, alertRule, timeRange, customTimeRangeGet a summarized count of your alerts grouped by various parameters (e.g. grouping by 'Severity' returns the count of alerts for each severity).
get_by_id_tenantselectalert_idGet a specific alert. Get information related to a specific alert.
get_allselectscopetargetResource, targetResourceType, targetResourceGroup, monitorService, monitorCondition, severity, alertState, alertRule, smartGroupId, includeContext, includeEgressConfig, pageCount, sortBy, sortOrder, select, timeRange, customTimeRangeList all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.
get_all_tenantselecttargetResource, targetResourceType, targetResourceGroup, monitorService, monitorCondition, severity, alertState, alertRule, smartGroupId, includeContext, includeEgressConfig, pageCount, sortBy, sortOrder, select, timeRange, customTimeRangeList all existing alerts, where the results can be filtered on the basis of multiple parameters (e.g. time range). The results can then be sorted on the basis specific fields, with the default being lastModifiedDateTime.
get_history_tenantexecalert_idGet the history of an alert, which captures any monitor condition changes (Fired/Resolved), alert state changes (New/Acknowledged/Closed) and applied action rules for that particular alert.
get_historyexecscope, alert_idGet the history of an alert, which captures any monitor condition changes (Fired/Resolved), alert state changes (New/Acknowledged/Closed) and applied action rules for that particular alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/{alertId}' and 'vm1' is deleted then if you want to get history of this particular alert then use parent resource of scope. So in this example get history call will look like this: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AlertsManagement/alerts/{alertId}/history'.
get_enrichmentsexecscope, alert_idGet the enrichments of an alert. It returns a collection of one object named default.
change_state_tenantexecalert_id, newStateChange the state of an alert.
change_stateexecscope, alert_id, newStateChange the state of an alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/{alertId}' and 'vm1' is deleted then if you want to change state of this particular alert then use parent resource of scope. So in this example change state call will look like this: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AlertsManagement/alerts/{alertId}'.
meta_dataexecidentifierList alerts meta data information based on value of identifier parameter.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
alert_idstringUnique ID of an alert instance. Required.
groupbystringThis parameter allows the result set to be grouped by input fields. For example, groupby=severity,alertstate. Known values are: "severity", "alertState", "monitorCondition", "monitorService", "signalType", and "alertRule". Required.
identifierstringIdentification of the information to be retrieved by API call. "MonitorServiceList" Required.
newStatestringNew state of the alert. Known values are: "New", "Acknowledged", and "Closed". Required.
scopestringundefined. Required.
alertRulestringFilter by specific alert rule. Default value is to select all. Default value is None.
alertStatestringFilter by state of the alert instance. Default value is to select all. Known values are: "New", "Acknowledged", and "Closed". Default value is None.
customTimeRangestringFilter by custom time range in the format / where time is in (ISO-8601 format)'. Permissible values is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none. Default value is None.
includeContextbooleanInclude context which has contextual data specific to the monitor service. Default value is false'. Default value is None.
includeEgressConfigbooleanInclude egress config which would be used for displaying the content in portal. Default value is 'false'. Default value is None.
includeSmartGroupsCountbooleanInclude count of the SmartGroups as part of the summary. Default value is 'false'. Default value is None.
monitorConditionstringFilter by monitor condition which is either 'Fired' or 'Resolved'. Default value is to select all. Known values are: "Fired" and "Resolved". Default value is None.
monitorServicestringFilter by monitor service which generates the alert instance. Default value is select all. Known values are: "Application Insights", "ActivityLog Administrative", "ActivityLog Security", "ActivityLog Recommendation", "ActivityLog Policy", "ActivityLog Autoscale", "Log Analytics", "Nagios", "Platform", "SCOM", "ServiceHealth", "SmartDetector", "VM Insights", "Zabbix", and "Resource Health". Default value is None.
pageCountintegerDetermines number of alerts returned per page in response. Permissible value is between 1 to 250. When the "includeContent" filter is selected, maximum value allowed is 25. Default value is 25. Default value is None.
selectstringThis filter allows to selection of the fields(comma separated) which would be part of the essential section. This would allow to project only the required fields rather than getting entire content. Default is to fetch all the fields in the essentials section. Default value is None.
severitystringFilter by severity. Default value is select all. Known values are: "Sev0", "Sev1", "Sev2", "Sev3", and "Sev4". Default value is None.
smartGroupIdstringFilter the alerts list by the Smart Group Id. Default value is none. Default value is None.
sortBystringSort the query results by input field, Default value is 'lastModifiedDateTime'. Known values are: "name", "severity", "alertState", "monitorCondition", "targetResource", "targetResourceName", "targetResourceGroup", "targetResourceType", "startDateTime", and "lastModifiedDateTime". Default value is None.
sortOrderstringSort the query results order in either ascending or descending. Default value is 'desc' for time fields and 'asc' for others. Known values are: "asc" and "desc". Default value is None.
targetResourcestringFilter by target resource( which is full ARM ID) Default value is select all. Default value is None.
targetResourceGroupstringFilter by target resource group name. Default value is select all. Default value is None.
targetResourceTypestringFilter by target resource type. Default value is select all. Default value is None.
timeRangestringFilter by time range by below listed values. Default value is 1 day. Known values are: "1h", "1d", "7d", and "30d". Default value is None.

SELECT examples

Get a specific alert. Get information related to a specific alert. If scope is a deleted resource then please use scope as parent resource of the delete resource. For example if my alert id is '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.AlertsManagement/alerts/{alertId}' and 'vm1' is deleted then if you want to get alert by id then use parent resource of scope. So in this example get alert by id call will look like this: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.AlertsManagement/alerts/{alertId}'.

SELECT
id,
name,
context,
customProperties,
egressConfig,
essentials,
systemData,
type
FROM azure.alerts_management.alerts
WHERE scope = '{{ scope }}' -- required
AND alert_id = '{{ alert_id }}' -- required
;

Lifecycle Methods

Get the history of an alert, which captures any monitor condition changes (Fired/Resolved), alert state changes (New/Acknowledged/Closed) and applied action rules for that particular alert.

EXEC azure.alerts_management.alerts.get_history_tenant 
@alert_id='{{ alert_id }}' --required
;