1
1
targetScope = 'resourceGroup'
2
2
3
- @minLength (1 )
3
+ @minLength (3 )
4
4
param imageTag string
5
- @minLength (1 )
5
+ @minLength (3 )
6
6
param environment string
7
- @minLength (1 )
7
+ @minLength (3 )
8
8
param location string
9
9
10
- @minLength (1 )
10
+ @minLength (3 )
11
11
@secure ()
12
- param containerAppEnvironmentId string
13
- @minLength (1 )
12
+ param containerAppEnvironmentName string
13
+ @minLength (3 )
14
14
@secure ()
15
15
param appInsightConnectionString string
16
- @minLength (1 )
16
+ @minLength (5 )
17
17
@secure ()
18
18
param appConfigurationName string
19
- @minLength (1 )
19
+ @minLength (3 )
20
20
@secure ()
21
21
param environmentKeyVaultName string
22
+ @minLength (3 )
23
+ @secure ()
24
+ param apimUri string
22
25
23
26
var namePrefix = 'dp-be-${environment }'
24
27
var baseImageUrl = 'ghcr.io/digdir/dialogporten-'
25
28
26
- resource appConfig 'Microsoft.AppConfiguration/configurationStores@2023-03-01' existing = {
27
- name : '${namePrefix }-appConfiguration'
29
+ resource appConfiguration 'Microsoft.AppConfiguration/configurationStores@2023-03-01' existing = {
30
+ name : appConfigurationName
31
+ }
32
+
33
+ resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' existing = {
34
+ name : containerAppEnvironmentName
28
35
}
29
36
30
37
var containerAppEnvVars = [
@@ -38,7 +45,7 @@ var containerAppEnvVars = [
38
45
}
39
46
{
40
47
name : 'AZURE_APPCONFIG_URI'
41
- value : appConfig .properties .endpoint
48
+ value : appConfiguration .properties .endpoint
42
49
}
43
50
{
44
51
name : 'ASPNETCORE_URLS'
@@ -63,7 +70,20 @@ module containerApp '../../modules/containerApp/main.bicep' = {
63
70
image : '${baseImageUrl }webapi:${imageTag }'
64
71
location : location
65
72
envVariables : containerAppEnvVars
66
- containerAppEnvId : containerAppEnvironmentId
73
+ containerAppEnvId : containerAppEnvironment .id
74
+ }
75
+ }
76
+
77
+ // If the APIM URI is not provided, we will use the default domain of the container app environment. We only do this for the so service.
78
+ var baseUri = !empty (apimUri ) ? apimUri : 'https://${containerAppName }.${containerAppEnvironment .properties .defaultDomain }'
79
+
80
+ module appConfigConfigurations '../../modules/appConfiguration/upsertKeyValue.bicep' = {
81
+ name : 'AppConfig_Add_DialogPortenBaseUri'
82
+ params : {
83
+ configStoreName : appConfigurationName
84
+ key : 'Application:Dialoporten:BaseUri'
85
+ value : baseUri
86
+ keyValueType : 'custom'
67
87
}
68
88
}
69
89
0 commit comments