Skip to content

Commit 5896e40

Browse files
authored
Merge pull request #63 from danrayson/feature/23-prod-deploy
fix cert bicep
2 parents 45709be + 931dd24 commit 5896e40

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎infra/main-apps.bicep‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module ui 'modules/ui-container.bicep' = {
5555
appDownloadUrl: blobBaseUrl
5656
customDomainName: customDomainName
5757
tags: tags
58+
environmentName: environmentName
5859
}
5960
dependsOn: [
6061
api

‎infra/modules/ui-container.bicep‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,36 @@ param apiHealthUrl string
88
param appDownloadUrl string
99
param customDomainName string = ''
1010
param tags object = {}
11+
param environmentName string
1112

1213
resource 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+
1641
resource 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

Comments
 (0)