Skip to main content

azure_sentinel_alert_rule_templates Resource

Use the azure_sentinel_alert_rule_templates InSpec audit resource to test properties related to alert rule templates for a resource group or the entire subscription.

See the Azure alert rule templates documentation for additional information.

Azure Rest API Version, Endpoint, And HTTP Client Parameters

This resource interacts with API versions supported by the resource provider. The api_version can be defined as a resource parameter. If not provided, the latest version will be used. For more information, refer to azure_generic_resource.

Unless defined, azure_cloud global endpoint, and default values for the HTTP client will be used. For more information, refer to the resource pack README.


This resource is available in the Chef InSpec Azure resource pack.

See the Chef InSpec documentation on cloud platforms for information on configuring your Azure environment for InSpec and creating an InSpec profile that uses the InSpec Azure resource pack.


An azure_sentinel_alert_rule_templates resource block returns all Azure alert rule templates, either within a Resource Group (if provided), or within an entire Subscription.

describe azure_sentinel_alert_rule_templates(resource_group: 'RESOURCE_GROUP', workspace_name: 'WORKSPACE_NAME') do

resource_group and workspace_name are required parameters.


Azure resource group that the targeted resource resides in.
Azure workspace Name for which alert rule templates are being retrieved.


A list of the unique resource names.

Field: name

A list of alert rule templates IDs .

Field: id

A list of properties for the resource.

Field: properties

A list of types for each resource.

Field: type

The severity for alerts created by this alert rule.

Field: severity

The status of the alert rule.

Field: status

The email of the user the incident is assigned to.

Field: triggerThreshold

The user principal name of the user the incident is assigned to.

Field: displayName

The name of the user the incident is assigned to.

Field: triggerOperator

The List of period (in ISO 8601 duration format) that this alert rule looks at.

Field: queryPeriod

The List of frequency (in ISO 8601 duration format) for this alert rule to run.

Field: queryFrequency


See the documentation on FilterTable for information on using filter criteria on plural resources.


Test if properties matches.

describe azure_sentinel_alert_rule_templates(resource_group: 'RESOURCE_GROUP', workspace_name: 'WORKSPACE_NAME') do
   its('names') { should include 'RESOURCE_NAME' }
   its('types') { should include 'Microsoft.SecurityInsights/AlertRuleTemplates' }
   its('kinds') { should include 'ALERT_RULE_KIND' }
   its('triggerThresholds') { should include INTEGER }
   its('statuses') { should include 'STATUS' }
   its('severities') { should include 'ALERT_SEVERITY' }
   its('queryFrequencies') { should include 'FREQUENCY' }
   its('queryPeriods') { should include 'PERIOD' }
   its('triggerOperators') { should include 'OPERATOR' }
   its('displayNames') { should include 'ALERT_RULE_DISPLAY_NAME' }

Test if any alert rule templates exist in the resource group.

describe azure_sentinel_alert_rule_templates(resource_group: 'RESOURCE_GROUP', workspace_name: 'WORKSPACE_NAME') do
  it { should exist }

Test that there aren’t any alert rule templates in a resource group.

**Should not exist if no alert rule templates are in the resource group.**

describe azure_sentinel_alert_rule_templates(resource_group: 'RESOURCE_GROUP', workspace_name: 'WORKSPACE_NAME') do
  it { should_not exist }

Azure Permissions

Your Service Principal must be set up with at least a contributor role on the subscription you wish to test.

Edit this page on GitHub

Thank you for your feedback!


Search Results