@@ -138,7 +138,6 @@ param enablePurgeProtection bool = false
138138@description ('Optional created by user name' )
139139param createdBy string = contains (deployer (), 'userPrincipalName' )? split (deployer ().userPrincipalName , '@' )[0 ]: deployer ().objectId
140140
141-
142141// ============== //
143142// Variables //
144143// ============== //
@@ -369,17 +368,107 @@ module userAssignedIdentity 'br/public:avm/res/managed-identity/user-assigned-id
369368 }
370369}
371370
372- // ========== Network Module ========== //
373- module network 'modules/network.bicep' = if (enablePrivateNetworking ) {
374- name : take ('module.network.${solutionSuffix }' , 64 )
371+ // ========== Virtual Network and Networking Components ========== //
372+
373+ // Virtual Network with NSGs and Subnets
374+ module virtualNetwork 'modules/virtualNetwork.bicep' = if (enablePrivateNetworking ) {
375+ name : take ('module.virtualNetwork.${solutionSuffix }' , 64 )
375376 params : {
376- resourcesName : solutionSuffix
377- logAnalyticsWorkSpaceResourceId : logAnalyticsWorkspaceResourceId
378- vmAdminUsername : vmAdminUsername ?? 'JumpboxAdminUser'
379- vmAdminPassword : vmAdminPassword ?? 'JumpboxAdminP@ssw0rd1234!'
380- vmSize : vmSize ?? 'Standard_DS2_v2' // Default VM size
377+ name : 'vnet-${solutionSuffix }'
378+ addressPrefixes : ['10.0.0.0/20' ] // 4096 addresses (enough for 8 /23 subnets or 16 /24)
381379 location : solutionLocation
382380 tags : tags
381+ logAnalyticsWorkspaceId : logAnalyticsWorkspaceResourceId
382+ resourceSuffix : solutionSuffix
383+ enableTelemetry : enableTelemetry
384+ }
385+ }
386+
387+ // Azure Bastion Host
388+ var bastionHostName = 'bas-${solutionSuffix }'
389+ module bastionHost 'br/public:avm/res/network/bastion-host:0.6.1' = if (enablePrivateNetworking ) {
390+ name : take ('avm.res.network.bastion-host.${bastionHostName }' , 64 )
391+ params : {
392+ name : bastionHostName
393+ skuName : 'Standard'
394+ location : solutionLocation
395+ virtualNetworkResourceId : virtualNetwork !.outputs .resourceId
396+ diagnosticSettings : [
397+ {
398+ name : 'bastionDiagnostics'
399+ workspaceResourceId : logAnalyticsWorkspaceResourceId
400+ logCategoriesAndGroups : [
401+ {
402+ categoryGroup : 'allLogs'
403+ enabled : true
404+ }
405+ ]
406+ }
407+ ]
408+ tags : tags
409+ enableTelemetry : enableTelemetry
410+ publicIPAddressObject : {
411+ name : 'pip-${bastionHostName }'
412+ zones : []
413+ }
414+ }
415+ }
416+
417+ // Jumpbox Virtual Machine
418+ var jumpboxVmName = take ('vm-jumpbox-${solutionSuffix }' , 15 )
419+ module jumpboxVM 'br/public:avm/res/compute/virtual-machine:0.15.0' = if (enablePrivateNetworking ) {
420+ name : take ('avm.res.compute.virtual-machine.${jumpboxVmName }' , 64 )
421+ params : {
422+ name : take (jumpboxVmName , 15 ) // Shorten VM name to 15 characters to avoid Azure limits
423+ vmSize : vmSize ?? 'Standard_DS2_v2'
424+ location : solutionLocation
425+ adminUsername : vmAdminUsername ?? 'JumpboxAdminUser'
426+ adminPassword : vmAdminPassword ?? 'JumpboxAdminP@ssw0rd1234!'
427+ tags : tags
428+ zone : 0
429+ imageReference : {
430+ offer : 'WindowsServer'
431+ publisher : 'MicrosoftWindowsServer'
432+ sku : '2019-datacenter'
433+ version : 'latest'
434+ }
435+ osType : 'Windows'
436+ osDisk : {
437+ name : 'osdisk-${jumpboxVmName }'
438+ managedDisk : {
439+ storageAccountType : 'Standard_LRS'
440+ }
441+ }
442+ encryptionAtHost : false // Some Azure subscriptions do not support encryption at host
443+ nicConfigurations : [
444+ {
445+ name : 'nic-${jumpboxVmName }'
446+ ipConfigurations : [
447+ {
448+ name : 'ipconfig1'
449+ subnetResourceId : virtualNetwork !.outputs .jumpboxSubnetResourceId
450+ }
451+ ]
452+ diagnosticSettings : [
453+ {
454+ name : 'jumpboxDiagnostics'
455+ workspaceResourceId : logAnalyticsWorkspaceResourceId
456+ logCategoriesAndGroups : [
457+ {
458+ categoryGroup : 'allLogs'
459+ enabled : true
460+ }
461+ ]
462+ metricCategories : [
463+ {
464+ category : 'AllMetrics'
465+ enabled : true
466+ }
467+ ]
468+ }
469+ ]
470+ }
471+ ]
383472 enableTelemetry : enableTelemetry
384473 }
385474}
@@ -425,8 +514,8 @@ module avmPrivateDnsZones 'br/public:avm/res/network/private-dns-zone:0.7.1' = [
425514 enableTelemetry : enableTelemetry
426515 virtualNetworkLinks : [
427516 {
428- name : take ('vnetlink-${network !.outputs .vnetName }-${split (zone , '.' )[1 ]}' , 80 )
429- virtualNetworkResourceId : network !.outputs .vnetResourceId
517+ name : take ('vnetlink-${virtualNetwork !.outputs .name }-${split (zone , '.' )[1 ]}' , 80 )
518+ virtualNetworkResourceId : virtualNetwork !.outputs .resourceId
430519 }
431520 ]
432521 }
@@ -539,7 +628,7 @@ module aiFoundryAiServices 'br:mcr.microsoft.com/bicep/avm/res/cognitive-service
539628 {
540629 name : 'pep-${aiFoundryAiServicesResourceName }'
541630 customNetworkInterfaceName : 'nic-${aiFoundryAiServicesResourceName }'
542- subnetResourceId : network !.outputs .subnetPrivateEndpointsResourceId
631+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
543632 privateDnsZoneGroup : {
544633 privateDnsZoneGroupConfigs : [
545634 {
@@ -666,7 +755,7 @@ module aiSearch 'br/public:avm/res/search/search-service:0.11.1' = {
666755 { privateDnsZoneResourceId : avmPrivateDnsZones [dnsZoneIndex .searchService ]!.outputs .resourceId }
667756 ]
668757 }
669- subnetResourceId : network !.outputs .subnetPrivateEndpointsResourceId
758+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
670759 service : 'searchService'
671760 }
672761 ]
@@ -756,7 +845,7 @@ module storageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
756845 }
757846 ]
758847 }
759- subnetResourceId : network !.outputs .subnetPrivateEndpointsResourceId
848+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
760849 service : 'blob'
761850 }
762851 {
@@ -769,7 +858,7 @@ module storageAccount 'br/public:avm/res/storage/storage-account:0.20.0' = {
769858 }
770859 ]
771860 }
772- subnetResourceId : network !.outputs .subnetPrivateEndpointsResourceId
861+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
773862 service : 'queue'
774863 }
775864 ]
@@ -833,7 +922,7 @@ module cosmosDB 'br/public:avm/res/document-db/database-account:0.15.0' = {
833922 ]
834923 }
835924 service : 'Sql'
836- subnetResourceId : network !.outputs .subnetPrivateEndpointsResourceId
925+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
837926 }
838927 ]
839928 : []
@@ -899,7 +988,7 @@ module keyvault 'br/public:avm/res/key-vault/vault:0.12.1' = {
899988 ]
900989 }
901990 service : 'vault'
902- subnetResourceId : network !.outputs .subnetPrivateEndpointsResourceId
991+ subnetResourceId : virtualNetwork !.outputs .pepsSubnetResourceId
903992 }
904993 ]
905994 : []
@@ -1086,7 +1175,7 @@ module webSite 'modules/web-sites.bicep' = {
10861175 // WAF aligned configuration for Private Networking
10871176 vnetRouteAllEnabled : enablePrivateNetworking ? true : false
10881177 vnetImagePullEnabled : enablePrivateNetworking ? true : false
1089- virtualNetworkSubnetId : enablePrivateNetworking ? network !.outputs .subnetWebResourceId : null
1178+ virtualNetworkSubnetId : enablePrivateNetworking ? virtualNetwork !.outputs .webSubnetResourceId : null
10901179 publicNetworkAccess : 'Enabled'
10911180 }
10921181}
0 commit comments