@@ -8,11 +8,36 @@ param apiHealthUrl string
88param appDownloadUrl string
99param customDomainName string = ''
1010param tags object = {}
11+ param environmentName string
1112
1213resource acr 'Microsoft.ContainerRegistry/registries@2023-07-01' existing = {
1314 name : acrName
1415}
1516
17+ resource containerAppEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' existing = {
18+ name : environmentName
19+ }
20+
21+ resource rootCert 'Microsoft.App/managedEnvironments/managedCertificates@2023-05-01' = if (customDomainName != '' ) {
22+ name : 'cert-${customDomainName }'
23+ parent : containerAppEnvironment
24+ location : location
25+ properties : {
26+ subjectName : customDomainName
27+ domainControlValidation : 'CNAME'
28+ }
29+ }
30+
31+ resource wwwCert 'Microsoft.App/managedEnvironments/managedCertificates@2023-05-01' = if (customDomainName != '' ) {
32+ name : 'cert-www-${customDomainName }'
33+ parent : containerAppEnvironment
34+ location : location
35+ properties : {
36+ subjectName : 'www.${customDomainName }'
37+ domainControlValidation : 'CNAME'
38+ }
39+ }
40+
1641resource uiContainer 'Microsoft.App/containerApps@2023-05-01' = {
1742 name : containerAppName
1843 location : location
@@ -33,11 +58,13 @@ resource uiContainer 'Microsoft.App/containerApps@2023-05-01' = {
3358 customDomains : customDomainName != '' ? [
3459 {
3560 name : customDomainName
36- bindingType : 'AzureManaged'
61+ bindingType : 'SniEnabled'
62+ certificateId : rootCert .id
3763 }
3864 {
3965 name : 'www.${customDomainName }'
40- bindingType : 'AzureManaged'
66+ bindingType : 'SniEnabled'
67+ certificateId : wwwCert .id
4168 }
4269 ] : []
4370 }
0 commit comments