Azure Monitor Smart Detector Alert Rule
This page shows how to write Terraform and Azure Resource Manager for Monitor Smart Detector Alert Rule and write them securely.
azurerm_monitor_smart_detector_alert_rule (Terraform)
The Smart Detector Alert Rule in Monitor can be configured in Terraform with the resource name azurerm_monitor_smart_detector_alert_rule
. The following sections describe 2 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_monitor_smart_detector_alert_rule" "alert_rule" {
name = ""
resource_group_name = ""
severity = "Sev0"
scope_resource_ids = "App Insights ids eg. [azurerm_application_insights.example.id]"
frequency = "PT1M"
resource "azurerm_monitor_smart_detector_alert_rule" "example" {
name = var.name
resource_group_name = module.resource_group.azurerm_resource_group.example.name
severity = var.severity
scope_resource_ids = [module.insight.azurerm_application_insights.example.id]
frequency = var.frequency
Parameters
-
description
optional - string -
detector_type
required - string -
enabled
optional - bool -
frequency
required - string -
id
optional computed - string -
name
required - string -
resource_group_name
required - string -
scope_resource_ids
required - set of string -
severity
required - string -
tags
optional - map from string to string -
throttling_duration
optional - string -
action_group
list block-
email_subject
optional - string -
ids
required - set of string -
webhook_payload
optional - string
-
-
timeouts
single block
Explanation in Terraform Registry
Manages an Monitor Smart Detector Alert Rule.
Tips: Best Practices for The Other Azure Monitor Resources
In addition to the azurerm_monitor_log_profile, Azure Monitor has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_monitor_log_profile
Ensure to enable the activity retention log
It is better to enable the activity retention log to ensure that all the information required for an effective investigation is still available.
Microsoft.AlertsManagement/smartdetectoralertrules (Azure Resource Manager)
The smartdetectoralertrules in Microsoft.AlertsManagement can be configured in Azure Resource Manager with the resource name Microsoft.AlertsManagement/smartdetectoralertrules
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"actionGroups_Application_Insights_Smart_Detection_name": {
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appInsightsName": {
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"applicationInsights": {
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"infra": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appInsightsName": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"applicationInsightsName": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"applicationInsightsName": {
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appinsightsname": {
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appinsightsname": {
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"author": "Anton Shcherbyna",
Frequently asked questions
What is Azure Monitor Smart Detector Alert Rule?
Azure Monitor Smart Detector Alert Rule is a resource for Monitor of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Monitor Smart Detector Alert Rule?
For Terraform, the dmaxim/wimc-net and VentsislavDinev/en_sample source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the Jakobaby/Arm-Maya, SkillsFundingAgency/das-platform-building-blocks and scoutzfiction/arm-templates source code examples are useful. See the Azure Resource Manager Example section for further details.