AzureRecipes

Alert Rules for Standard Monitoring Aspects

This snippet provides the implementation of the typical key aspects of often used Azure PaaS resources, as explained and documented in this “Best Practices” post.

Dependencies / Setup

The Action Group(s) must be created in advance and its resource identifier specified as parameter. Therefore, an alerting strategy should exist, which defines responsibilities and required notification flows. This snippet correlates with this Alerting Strategy Template and plays well with following setup:

Action Groups on organisation level (shared for all applications): Snippet alerting-infra-organisation-level

Action Group(s) and DevOps Handler/Connector on application level (but common for all modules and independent from environments): Snippet alerting-infra-application-level

Contents

Bicep Module including all Alert Rules

For consistency it is recommended to use this Bicep module in projects. Resource-specific alert rules are deployed only when according parameter is correctly specified.

Full Alerting Setup

module alertingRes './modules.alerting.bicep' = {
  name: 'alerting-definitions'
  scope: resourceGroup()
  params: {
    resourceNamePrefix: resourceNamePrefix
    resourceNameSuffix: resourceNameSuffix
    resourceLocation: resourceLocation
    appInsightsResId: appInsightsRes.id
    apiManagementResId: apiManagementRes.outputs.apiMgmtResId
    dataFactoryResId: '' // No Data Factory deployed
    logicAppResId: '' // No Logic App deployed
    sqlDatabaseResId: sqlDatabaseRes.id
    cosmosDbAccountResId: '' // No Cosmos DB deployed
    serviceBusResId: '' // No Service Bus deployed
    actionGrpOrgOpsIndicationsResId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/org-apps-ops-c/providers/Microsoft.Insights/actiongroups/org-apps-indications-ag-c'
    actionGrpOrgOpsIssuesResId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/org-apps-ops-c/providers/Microsoft.Insights/actiongroups/org-apps-issues-ag-c'
    actionGrpAppDevOpsTeamResId: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/project-customer-ops-c/providers/Microsoft.Insights/actiongroups/project-customer-devops-ag-c'
    enableAlertRules: isProductionEnvironment
  }
}

This module can and should be taken as a basis and then extended with custom alert rule definitions such as:

Single Alert Rule definitions

The referenced Bicep modules group Alert Rules by resource type and use case. All of them can also be directly used and cherry-picked.

Security & Documentation:

Operational Indications:

Operational Incidents (concrete failures or outages):