From bf737c624ea53d855ea930b5db2707acc3e71259 Mon Sep 17 00:00:00 2001 From: Martin Todorov <> Date: Wed, 30 Oct 2024 09:12:30 +0100 Subject: [PATCH] Fjernet exception handling fra bicep filer --- .azure/infrastructure/main.bicep | 1 - .../containerAppEnvironment/main.bicep | 51 ------------------- 2 files changed, 52 deletions(-) diff --git a/.azure/infrastructure/main.bicep b/.azure/infrastructure/main.bicep index 71b6e5e4..d92a618c 100644 --- a/.azure/infrastructure/main.bicep +++ b/.azure/infrastructure/main.bicep @@ -146,7 +146,6 @@ module containerAppEnv '../modules/containerAppEnvironment/main.bicep' = { location: location namePrefix: namePrefix storageAccountName: storageAccountName - emailReceiver: notificationEmail } } output resourceGroupName string = resourceGroup.name diff --git a/.azure/modules/containerAppEnvironment/main.bicep b/.azure/modules/containerAppEnvironment/main.bicep index 6b14f1ac..58dc069c 100644 --- a/.azure/modules/containerAppEnvironment/main.bicep +++ b/.azure/modules/containerAppEnvironment/main.bicep @@ -5,7 +5,6 @@ param namePrefix string param keyVaultName string param storageAccountName string @secure() -param emailReceiver string resource log_analytics_workspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' = { name: '${namePrefix}-log' @@ -89,56 +88,6 @@ module storageAccountConnectionStringSecret '../keyvault/upsertSecret.bicep' = { } } -resource application_insights_action 'Microsoft.Insights/actionGroups@2023-01-01' = if (emailReceiver != null && emailReceiver != '') { - name: '${namePrefix}-action' - location: 'global' // action group locations is limited, change to use location variable when new locations is added - dependsOn: [application_insights, containerAppEnvironment] - properties: { - groupShortName: 'corr-alert' - enabled: true - emailReceivers: [ - { - name: 'emailReceiverForAlert' - emailAddress: emailReceiver - } - ] - } -} -resource exceptionOccuredAlertRule 'Microsoft.Insights/scheduledQueryRules@2023-03-15-preview' = if (emailReceiver != null && emailReceiver != '') { - name: '${namePrefix}-500-exception-occured' - location: location - properties: { - description: 'Alert for 500 errors in correspondence' - enabled: true - severity: 1 - evaluationFrequency: 'PT5M' - windowSize: 'PT5M' - scopes: [log_analytics_workspace.id] - autoMitigate: false - targetResourceTypes: [ - 'microsoft.insights/components' - ] - criteria: { - allOf: [ - { - query: 'AppExceptions | where Properties.StatusCode startswith "5" ' - operator: 'GreaterThan' - threshold: 0 - timeAggregation: 'Count' - failingPeriods: { - numberOfEvaluationPeriods: 1 - minFailingPeriodsToAlert: 1 - } - } - ] - } - actions: { - actionGroups: [ - application_insights_action.id - ] - } - } -} output containerAppEnvironmentId string = containerAppEnvironment.id