From 77873e1cb2365b560caf7297335cdd34139a00fa Mon Sep 17 00:00:00 2001 From: Are Almaas Date: Thu, 5 Sep 2024 12:50:49 +0200 Subject: [PATCH] fix: add applicaation insights and aspnetcore environment --- .../sync-subject-resource-mappings-job/main.bicep | 13 +++++++++++++ .../prod.bicepparam | 1 + .../staging.bicepparam | 1 + .../test.bicepparam | 1 + .github/workflows/action-deploy-apps.yml | 1 + 5 files changed, 17 insertions(+) diff --git a/.azure/applications/sync-subject-resource-mappings-job/main.bicep b/.azure/applications/sync-subject-resource-mappings-job/main.bicep index 26f9cc267..92491b85f 100644 --- a/.azure/applications/sync-subject-resource-mappings-job/main.bicep +++ b/.azure/applications/sync-subject-resource-mappings-job/main.bicep @@ -26,6 +26,11 @@ param environmentKeyVaultName string @minLength(9) param jobSchedule string +@description('The connection string for Application Insights') +@minLength(3) +@secure() +param appInsightConnectionString string + var namePrefix = 'dp-be-${environment}' var baseImageUrl = 'ghcr.io/digdir/dialogporten-' var tags = { @@ -46,6 +51,14 @@ var containerAppEnvVars = [ name: 'Infrastructure__DialogDbConnectionString' secretRef: 'dbconnectionstring' } + { + name: 'ASPNETCORE_ENVIRONMENT' + value: environment + } + { + name: 'APPLICATIONINSIGHTS_CONNECTION_STRING' + value: appInsightConnectionString + } ] // https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-deployment#example-1 diff --git a/.azure/applications/sync-subject-resource-mappings-job/prod.bicepparam b/.azure/applications/sync-subject-resource-mappings-job/prod.bicepparam index 40267618c..20c50deda 100644 --- a/.azure/applications/sync-subject-resource-mappings-job/prod.bicepparam +++ b/.azure/applications/sync-subject-resource-mappings-job/prod.bicepparam @@ -8,3 +8,4 @@ param jobSchedule = '*/5 * * * *' // Runs every 5 minutes //secrets param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME') param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME') +param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING') diff --git a/.azure/applications/sync-subject-resource-mappings-job/staging.bicepparam b/.azure/applications/sync-subject-resource-mappings-job/staging.bicepparam index e1e858d26..e65df009a 100644 --- a/.azure/applications/sync-subject-resource-mappings-job/staging.bicepparam +++ b/.azure/applications/sync-subject-resource-mappings-job/staging.bicepparam @@ -8,3 +8,4 @@ param jobSchedule = '*/5 * * * *' // Runs every 5 minutes //secrets param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME') param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME') +param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING') diff --git a/.azure/applications/sync-subject-resource-mappings-job/test.bicepparam b/.azure/applications/sync-subject-resource-mappings-job/test.bicepparam index e22529190..a9de73cac 100644 --- a/.azure/applications/sync-subject-resource-mappings-job/test.bicepparam +++ b/.azure/applications/sync-subject-resource-mappings-job/test.bicepparam @@ -8,3 +8,4 @@ param jobSchedule = '*/5 * * * *' // Runs every 5 minutes //secrets param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME') param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_VAULT_NAME') +param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING') diff --git a/.github/workflows/action-deploy-apps.yml b/.github/workflows/action-deploy-apps.yml index a610f0d0c..2be580755 100644 --- a/.github/workflows/action-deploy-apps.yml +++ b/.github/workflows/action-deploy-apps.yml @@ -256,6 +256,7 @@ jobs: # secrets AZURE_CONTAINER_APP_ENVIRONMENT_NAME: ${{ secrets.AZURE_CONTAINER_APP_ENVIRONMENT_NAME }} AZURE_ENVIRONMENT_KEY_VAULT_NAME: ${{ secrets.AZURE_ENVIRONMENT_KEY_VAULT_NAME }} + AZURE_APP_INSIGHTS_CONNECTION_STRING: ${{ secrets.AZURE_APP_INSIGHTS_CONNECTION_STRING }} with: scope: resourcegroup template: ./.azure/applications/${{ matrix.name }}/main.bicep