Skip to content

Commit a469b39

Browse files
committed
deployment sucess JumpBox and Bastion Working
1 parent 6153f4c commit a469b39

2 files changed

Lines changed: 86 additions & 53 deletions

File tree

infra/main.bicep

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -348,55 +348,6 @@ module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.11.
348348
}
349349
}
350350

351-
module containerAppFrontend 'br/public:avm/res/app/container-app:0.17.0' = {
352-
name: take('container-app-frontend-${resourcesName}-deployment', 64)
353-
params: {
354-
name: take('ca-${resourcesName}frontend', 32)
355-
location: location
356-
environmentResourceId: containerAppsEnvironment.outputs.resourceId
357-
managedIdentities: {
358-
userAssignedResourceIds: [
359-
appIdentity.outputs.resourceId
360-
]
361-
}
362-
containers: [
363-
{
364-
env: [
365-
{
366-
name: 'API_URL'
367-
value: 'https://${containerAppBackend.outputs.fqdn}'
368-
}
369-
]
370-
image: 'cmsacontainerreg.azurecr.io/cmsafrontend:latest'
371-
name: 'cmsafrontend'
372-
resources: {
373-
cpu: '1'
374-
memory: '2.0Gi'
375-
}
376-
}
377-
]
378-
ingressTargetPort: 3000
379-
ingressExternal: true
380-
scaleSettings: {
381-
maxReplicas: enableScaling ? 3 : 1
382-
minReplicas: 1
383-
rules: enableScaling
384-
? [
385-
{
386-
name: 'http-scaler'
387-
http: {
388-
metadata: {
389-
concurrentRequests: 100
390-
}
391-
}
392-
}
393-
]
394-
: []
395-
}
396-
tags: allTags
397-
enableTelemetry: enableTelemetry
398-
}
399-
}
400351

401352
module containerAppBackend 'br/public:avm/res/app/container-app:0.17.0' = {
402353
name: take('container-app-backend-${resourcesName}-deployment', 64)
@@ -563,5 +514,55 @@ module containerAppBackend 'br/public:avm/res/app/container-app:0.17.0' = {
563514
}
564515
}
565516

517+
module containerAppFrontend 'br/public:avm/res/app/container-app:0.17.0' = {
518+
name: take('container-app-frontend-${resourcesName}-deployment', 64)
519+
params: {
520+
name: take('ca-${resourcesName}frontend', 32)
521+
location: location
522+
environmentResourceId: containerAppsEnvironment.outputs.resourceId
523+
managedIdentities: {
524+
userAssignedResourceIds: [
525+
appIdentity.outputs.resourceId
526+
]
527+
}
528+
containers: [
529+
{
530+
env: [
531+
{
532+
name: 'API_URL'
533+
value: 'https://${containerAppBackend.outputs.fqdn}'
534+
}
535+
]
536+
image: 'cmsacontainerreg.azurecr.io/cmsafrontend:latest'
537+
name: 'cmsafrontend'
538+
resources: {
539+
cpu: '1'
540+
memory: '2.0Gi'
541+
}
542+
}
543+
]
544+
ingressTargetPort: 3000
545+
ingressExternal: true
546+
scaleSettings: {
547+
maxReplicas: enableScaling ? 3 : 1
548+
minReplicas: 1
549+
rules: enableScaling
550+
? [
551+
{
552+
name: 'http-scaler'
553+
http: {
554+
metadata: {
555+
concurrentRequests: 100
556+
}
557+
}
558+
}
559+
]
560+
: []
561+
}
562+
tags: allTags
563+
enableTelemetry: enableTelemetry
564+
}
565+
}
566+
566567
@description('The resource group the resources were deployed into.')
567568
output resourceGroupName string = resourceGroup().name

infra/modules/network.bicep

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ module network 'network/main.bicep' = {
8181
destinationAddressPrefixes: ['10.0.0.0/23']
8282
}
8383
}
84+
{
85+
name: 'AllowIntraSubnetTraffic'
86+
properties: {
87+
access: 'Allow'
88+
direction: 'Inbound'
89+
priority: 200
90+
protocol: '*'
91+
sourcePortRange: '*'
92+
destinationPortRange: '*'
93+
sourceAddressPrefixes: ['10.0.0.0/23'] // From same subnet
94+
destinationAddressPrefixes: ['10.0.0.0/23'] // To same subnet
95+
}
96+
}
97+
{
98+
name: 'AllowAzureLoadBalancer'
99+
properties: {
100+
access: 'Allow'
101+
direction: 'Inbound'
102+
priority: 300
103+
protocol: '*'
104+
sourcePortRange: '*'
105+
destinationPortRange: '*'
106+
sourceAddressPrefix: 'AzureLoadBalancer'
107+
destinationAddressPrefix: '10.0.0.0/23'
108+
}
109+
}
84110
]
85111
}
86112
delegation: 'Microsoft.App/environments'
@@ -94,7 +120,7 @@ module network 'network/main.bicep' = {
94120
]
95121
bastionConfiguration: {
96122
name: 'bastion-${resourcesName}'
97-
subnetAddressPrefixes: ['10.0.10.0/23']
123+
subnetAddressPrefixes: ['10.0.10.0/26']
98124
}
99125
jumpboxConfiguration: {
100126
name: 'vm-jumpbox-${resourcesName}'
@@ -108,16 +134,16 @@ module network 'network/main.bicep' = {
108134
name: 'jumpbox-nsg'
109135
securityRules: [
110136
{
111-
name: 'AllowJumpboxInbound'
137+
name: 'AllowRdpFromBastion'
112138
properties: {
113139
access: 'Allow'
114140
direction: 'Inbound'
115141
priority: 100
116142
protocol: 'Tcp'
117143
sourcePortRange: '*'
118-
destinationPortRange: '22'
144+
destinationPortRange: '3389'
119145
sourceAddressPrefixes: [
120-
'10.0.7.0/24' // Azure Bastion subnet as an example here. You can adjust this as needed by adding more
146+
'10.0.10.0/26' // Azure Bastion subnet
121147
]
122148
destinationAddressPrefixes: ['10.0.12.0/23']
123149
}
@@ -141,3 +167,9 @@ output subnetWebResourceId string = first(filter(network.outputs.subnets, s => s
141167

142168
@description('Resource ID of the "peps" subnet for Private Endpoints.')
143169
output subnetPrivateEndpointsResourceId string = first(filter(network.outputs.subnets, s => s.name == 'peps')).?resourceId ?? ''
170+
171+
@description('Resource ID of the Bastion Host.')
172+
output bastionResourceId string = network.outputs.bastionHostId
173+
174+
@description('Resource ID of the Jumpbox VM.')
175+
output jumpboxResourceId string = network.outputs.jumpboxResourceId

0 commit comments

Comments
 (0)