Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .azure/applications/graphql/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ param otelTraceSamplerRatio string
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'

Expand Down Expand Up @@ -173,5 +183,18 @@ module appConfigReaderAccessPolicy '../../modules/appConfiguration/addReaderRole
}
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${containerAppName}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
dependsOn: [containerApp, keyVaultReaderAccessPolicy]
}

output name string = containerApp.outputs.name
output revisionName string = containerApp.outputs.revisionName
2 changes: 2 additions & 0 deletions .azure/applications/graphql/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_V
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NAME')
param postgresServerName = readEnvironmentVariable('AZURE_POSTGRES_SERVER_NAME')
param virtualNetworkName = readEnvironmentVariable('AZURE_VIRTUAL_NETWORK_NAME')
23 changes: 23 additions & 0 deletions .azure/applications/service/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ param otelTraceSamplerRatio string
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

@description('Minimum number of replicas')
@minValue(1)
param minReplicas int = 1
Expand Down Expand Up @@ -192,5 +202,18 @@ module containerApp '../../modules/containerApp/main.bicep' = {
]
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${containerAppName}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
dependsOn: [containerApp, keyVaultReaderAccessPolicy]
}

output name string = containerApp.outputs.name
output revisionName string = containerApp.outputs.revisionName
2 changes: 2 additions & 0 deletions .azure/applications/service/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_V
param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param serviceBusNamespaceName = readEnvironmentVariable('AZURE_SERVICE_BUS_NAMESPACE_NAME')
param postgresServerName = readEnvironmentVariable('AZURE_POSTGRES_SERVER_NAME')
param virtualNetworkName = readEnvironmentVariable('AZURE_VIRTUAL_NETWORK_NAME')
param minReplicas = 2

param resources = {
Expand Down
2 changes: 2 additions & 0 deletions .azure/applications/service/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_V
param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NAME')
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param serviceBusNamespaceName = readEnvironmentVariable('AZURE_SERVICE_BUS_NAMESPACE_NAME')
param postgresServerName = readEnvironmentVariable('AZURE_POSTGRES_SERVER_NAME')
param virtualNetworkName = readEnvironmentVariable('AZURE_VIRTUAL_NETWORK_NAME')

param otelTraceSamplerRatio = '1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ param replicaTimeOutInSeconds int
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'
var tags = {
Expand All @@ -58,6 +68,26 @@ resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2024-
tags: tags
}

module keyVaultReaderAccessPolicy '../../modules/keyvault/addReaderRoles.bicep' = {
name: 'keyVaultReaderAccessPolicy-${name}'
params: {
keyvaultName: environmentKeyVaultName
principalIds: [managedIdentity.id]
}
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${name}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
}

var containerAppEnvVars = [
{
name: 'Infrastructure__DialogDbConnectionString'
Expand Down Expand Up @@ -114,14 +144,7 @@ module migrationJob '../../modules/containerAppJob/main.bicep' = {
replicaTimeOutInSeconds: replicaTimeOutInSeconds
workloadProfileName: workloadProfileName
}
}

module keyVaultReaderAccessPolicy '../../modules/keyvault/addReaderRoles.bicep' = {
name: 'keyVaultReaderAccessPolicy-${name}'
params: {
keyvaultName: environmentKeyVaultName
principalIds: [migrationJob.outputs.identityPrincipalId]
}
dependsOn: [keyVaultReaderAccessPolicy, addPostgresUser]
}

output identityPrincipalId string = migrationJob.outputs.identityPrincipalId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ param replicaTimeOutInSeconds int
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'
var tags = {
Expand Down Expand Up @@ -124,5 +134,18 @@ module keyVaultReaderAccessPolicy '../../modules/keyvault/addReaderRoles.bicep'
}
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${name}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
dependsOn: [migrationJob, keyVaultReaderAccessPolicy]
}

output identityPrincipalId string = managedIdentity.properties.principalId
output name string = migrationJob.outputs.name
23 changes: 23 additions & 0 deletions .azure/applications/web-api-eu/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ param otelTraceSamplerRatio string
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'
var tags = {
Expand Down Expand Up @@ -176,5 +186,18 @@ module appConfigReaderAccessPolicy '../../modules/appConfiguration/addReaderRole
}
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${containerAppName}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
dependsOn: [containerApp, keyVaultReaderAccessPolicy]
}

output name string = containerApp.outputs.name
output revisionName string = containerApp.outputs.revisionName
23 changes: 23 additions & 0 deletions .azure/applications/web-api-migration-job/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ param replicaTimeOutInSeconds int
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

var namePrefix = 'dp-be-${environment}'
var baseImageUrl = 'ghcr.io/altinn/dialogporten-'
var tags = {
Expand Down Expand Up @@ -92,5 +102,18 @@ module keyVaultReaderAccessPolicy '../../modules/keyvault/addReaderRoles.bicep'
}
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${name}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
dependsOn: [migrationJob, keyVaultReaderAccessPolicy]
}

output identityPrincipalId string = managedIdentity.properties.principalId
output name string = migrationJob.outputs.name
23 changes: 23 additions & 0 deletions .azure/applications/web-api-so/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ param otelTraceSamplerRatio string
@description('The workload profile name to use, defaults to "Consumption"')
param workloadProfileName string = 'Consumption'

@description('The name of the PostgreSQL server')
@minLength(3)
@secure()
param postgresServerName string

@description('The name of the virtual network')
@minLength(3)
@secure()
param virtualNetworkName string

@description('Minimum number of replicas')
@minValue(1)
param minReplicas int = 1
Expand Down Expand Up @@ -176,5 +186,18 @@ module appConfigReaderAccessPolicy '../../modules/appConfiguration/addReaderRole
}
}

module addPostgresUser '../../modules/postgreSql/addDatabaseUser.bicep' = {
name: 'addPostgresUser-${containerAppName}'
params: {
postgresServerName: postgresServerName
managedIdentityName: managedIdentity.name
managedIdentityObjectId: managedIdentity.properties.principalId
location: location
tags: tags
virtualNetworkName: virtualNetworkName
}
dependsOn: [containerApp, keyVaultReaderAccessPolicy]
}

output name string = containerApp.outputs.name
output revisionName string = containerApp.outputs.revisionName
2 changes: 2 additions & 0 deletions .azure/applications/web-api-so/prod.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_V
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NAME')
param postgresServerName = readEnvironmentVariable('AZURE_POSTGRES_SERVER_NAME')
param virtualNetworkName = readEnvironmentVariable('AZURE_VIRTUAL_NETWORK_NAME')
2 changes: 2 additions & 0 deletions .azure/applications/web-api-so/test.bicepparam
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ param environmentKeyVaultName = readEnvironmentVariable('AZURE_ENVIRONMENT_KEY_V
param containerAppEnvironmentName = readEnvironmentVariable('AZURE_CONTAINER_APP_ENVIRONMENT_NAME')
param appInsightConnectionString = readEnvironmentVariable('AZURE_APP_INSIGHTS_CONNECTION_STRING')
param appConfigurationName = readEnvironmentVariable('AZURE_APP_CONFIGURATION_NAME')
param postgresServerName = readEnvironmentVariable('AZURE_POSTGRES_SERVER_NAME')
param virtualNetworkName = readEnvironmentVariable('AZURE_VIRTUAL_NETWORK_NAME')
2 changes: 2 additions & 0 deletions .azure/infrastructure/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,5 @@ module redisConnectionStringAppConfig '../modules/appConfiguration/upsertKeyValu
output resourceGroupName string = resourceGroup.name
output containerAppEnvId string = containerAppEnv.outputs.containerAppEnvId
output environmentKeyVaultName string = environmentKeyVault.outputs.name
output postgresServerName string = postgresql.outputs.postgresServerName
output virtualNetworkName string = vnet.outputs.virtualNetworkName
Loading