AzureRecipes

Application Insights Custom (URL Ping) or Standard Availability Test

Application Insights has a built-in job runner that calls configured endpoints periodically (at either 5-, 10- or 15-minute intervals) from multiple locations and determines their availability as measured by response status and duration.

More Information: https://learn.microsoft.com/en-us/azure/azure-monitor/app/availability-overview

Best Practises

Usage

This Bicep module can directly integrated into the deployment like:

param apiMgmtResName string
param apiMgmtSubscriptionMonitoring string

module availabilityTestApimTestRes './modules.appInsightsAvailabilityTest.bicep' = if(!empty(appInsightsResId) && !empty(apiManagementResName) && !empty(availabilityTestApiMgmtSubscription)) {
  name: 'availability-test-apim-test'
  scope: resourceGroup()
  params: {
    resourceNamePrefix: resourceNamePrefix
    resourceNameSuffix: resourceNameSuffix
    resourceLocation: resourceLocation
    appInsightsResId: appInsightsResId
    actionGroupResId: actionGrpOrgOpsIssuesResId // Can be empty if createAlertRuleForTest = false
    availabilityTestDisplayName: 'Test API'
    availabilityTestShortName: 'test'
    availabilityTestUrl: 'https://${apiMgmtResName}.azure-api.net/test-api/status?subscription-key=${apiMgmtSubscriptionMonitoring}'
    availabilityTestTypeStandard: true
    createAlertRuleForTest: true
    enableAlertRules: enableAlertRules
  }
}

This is fully compatible with a general Alerting Strategy and can be appended to an alerting module that deploys all Alert Rules of an application

Deploy to Azure

Further Notes