Skip to main content

alert_rules

Creates, updates, deletes, gets or lists a alert_rules resource.

Overview

Namealert_rules
TypeResource
Idazure.monitor.alert_rules

Fields

NameDatatypeDescription
idtextAzure resource Id
nametextAzure resource name
descriptiontextfield from the properties object
actiontextfield from the properties object
actionstextfield from the properties object
conditiontextfield from the properties object
is_enabledtextfield from the properties object
last_updated_timetextfield from the properties object
locationtextResource location
provisioning_statetextfield from the properties object
resourceGroupNametextfield from the properties object
ruleNametextfield from the properties object
subscriptionIdtextfield from the properties object
system_datatextfield from the properties object
tagstextGets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters.
typetextAzure resource type

Methods

NameAccessible byRequired ParamsDescription
getSELECTresourceGroupName, ruleName, subscriptionIdGets a classic metric alert rule
list_by_resource_groupSELECTresourceGroupName, subscriptionIdList the classic metric alert rules within a resource group.
list_by_subscriptionSELECTsubscriptionIdList the classic metric alert rules within a subscription.
create_or_updateINSERTresourceGroupName, ruleName, subscriptionId, data__propertiesCreates or updates a classic metric alert rule.
deleteDELETEresourceGroupName, ruleName, subscriptionIdDeletes a classic metric alert rule
updateUPDATEresourceGroupName, ruleName, subscriptionIdUpdates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method.

SELECT examples

List the classic metric alert rules within a subscription.

SELECT
id,
name,
description,
action,
actions,
condition,
is_enabled,
last_updated_time,
location,
provisioning_state,
resourceGroupName,
ruleName,
subscriptionId,
system_data,
tags,
type
FROM azure.monitor.vw_alert_rules
WHERE subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new alert_rules resource.

/*+ create */
INSERT INTO azure.monitor.alert_rules (
resourceGroupName,
ruleName,
subscriptionId,
data__properties,
location,
tags,
properties
)
SELECT
'{{ resourceGroupName }}',
'{{ ruleName }}',
'{{ subscriptionId }}',
'{{ data__properties }}',
'{{ location }}',
'{{ tags }}',
'{{ properties }}'
;

UPDATE example

Updates a alert_rules resource.

/*+ update */
UPDATE azure.monitor.alert_rules
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}'
AND ruleName = '{{ ruleName }}'
AND subscriptionId = '{{ subscriptionId }}';

DELETE example

Deletes the specified alert_rules resource.

/*+ delete */
DELETE FROM azure.monitor.alert_rules
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND ruleName = '{{ ruleName }}'
AND subscriptionId = '{{ subscriptionId }}';