@@ -108,9 +108,19 @@ param existingLogAnalyticsWorkspaceId string = ''
108108@description ('Optional. Resource ID of an existing Foundry project.' )
109109param azureExistingAIProjectResourceId string = ''
110110
111- @description ('Optional. Deploy Azure Bastion and Jumpbox VM for private network administration.' )
111+ @description ('Optional. Deploy Azure Bastion and Jumpbox resources for private network administration.' )
112112param deployBastionAndJumpbox bool = false
113113
114+ @description ('Optional. Jumpbox VM size. Must support accelerated networking and Premium SSD.' )
115+ param vmSize string = ''
116+
117+ @description ('Optional. Jumpbox VM admin username.' )
118+ param vmAdminUsername string = ''
119+
120+ @description ('Optional. Jumpbox VM admin password.' )
121+ @secure ()
122+ param vmAdminPassword string = ''
123+
114124@description ('Optional. The tags to apply to all deployed Azure resources.' )
115125param tags object = {}
116126
@@ -400,17 +410,111 @@ module containerRegistry 'br/public:avm/res/container-registry/registry:0.9.0' =
400410}
401411
402412// ========== Virtual Network and Networking Components ========== //
413+ var deployAdminAccessResources = enablePrivateNetworking && deployBastionAndJumpbox && !empty (vmAdminPassword )
403414module virtualNetwork 'modules/virtualNetwork.bicep' = if (enablePrivateNetworking ) {
404415 name : take ('module.virtualNetwork.${solutionSuffix }' , 64 )
405416 params : {
406417 vnetName : 'vnet-${solutionSuffix }'
407- vnetLocation : solutionLocation
408- vnetAddressPrefixes : ['10.0.0.0/20' ]
418+ addressPrefixes : ['10.0.0.0/20' ] // 4096 addresses (enough for 8 /23 subnets or 16 /24)
419+ location : solutionLocation
420+ deployBastionAndJumpbox : deployAdminAccessResources
409421 tags : tags
410422 logAnalyticsWorkspaceId : logAnalyticsWorkspaceResourceId
411- enableTelemetry : enableTelemetry
412423 resourceSuffix : solutionSuffix
413- deployBastionAndJumpbox : deployBastionAndJumpbox
424+ enableTelemetry : enableTelemetry
425+ }
426+ }
427+
428+ // Azure Bastion Host
429+ var bastionHostName = 'bas-${solutionSuffix }'
430+ var zoneSupportedJumpboxLocations = [
431+ 'australiaeast'
432+ 'centralus'
433+ 'eastus'
434+ 'eastus2'
435+ 'japaneast'
436+ 'northeurope'
437+ 'southeastasia'
438+ 'swedencentral'
439+ 'uksouth'
440+ 'westus3'
441+ ]
442+ module bastionHost 'br/public:avm/res/network/bastion-host:0.8.2' = if (deployAdminAccessResources ) {
443+ name : take ('avm.res.network.bastion-host.${bastionHostName }' , 64 )
444+ params : {
445+ name : bastionHostName
446+ skuName : 'Standard'
447+ location : solutionLocation
448+ virtualNetworkResourceId : virtualNetwork !.outputs .resourceId
449+ diagnosticSettings : !empty (logAnalyticsWorkspaceResourceId )
450+ ? [
451+ {
452+ name : 'bastionDiagnostics'
453+ workspaceResourceId : logAnalyticsWorkspaceResourceId
454+ logCategoriesAndGroups : [
455+ {
456+ categoryGroup : 'allLogs'
457+ enabled : true
458+ }
459+ ]
460+ }
461+ ]
462+ : []
463+ tags : tags
464+ enableTelemetry : enableTelemetry
465+ publicIPAddressObject : {
466+ name : 'pip-${bastionHostName }'
467+ }
468+ }
469+ }
470+
471+ // Jumpbox Virtual Machine
472+ var jumpboxUniqueToken = take (uniqueString (resourceGroup ().id , solutionSuffix ), 10 )
473+ var jumpboxVmName = take ('vm-${jumpboxUniqueToken }' , 15 )
474+ module jumpboxVM 'br/public:avm/res/compute/virtual-machine:0.21.0' = if (deployAdminAccessResources ) {
475+ name : take ('avm.res.compute.virtual-machine.${jumpboxVmName }' , 64 )
476+ params : {
477+ name : take (jumpboxVmName , 15 )
478+ enableTelemetry : enableTelemetry
479+ computerName : take (jumpboxVmName , 15 )
480+ osType : 'Windows'
481+ vmSize : empty (vmSize ) ? 'Standard_D2s_v5' : vmSize
482+ adminUsername : empty (vmAdminUsername ) ? 'JumpboxAdminUser' : vmAdminUsername
483+ adminPassword : vmAdminPassword
484+ managedIdentities : {
485+ userAssignedResourceIds : [
486+ userAssignedIdentity .outputs .resourceId
487+ ]
488+ }
489+ availabilityZone : contains (zoneSupportedJumpboxLocations , solutionLocation ) ? 1 : -1
490+ imageReference : {
491+ publisher : 'microsoft-dsvm'
492+ offer : 'dsvm-win-2022'
493+ sku : 'winserver-2022'
494+ version : 'latest'
495+ }
496+ nicConfigurations : [
497+ {
498+ name : 'nic-${jumpboxVmName }'
499+ enableAcceleratedNetworking : true
500+ ipConfigurations : [
501+ {
502+ name : 'ipconfig01'
503+ subnetResourceId : virtualNetwork !.outputs .jumpboxSubnetResourceId
504+ }
505+ ]
506+ }
507+ ]
508+ osDisk : {
509+ caching : 'ReadWrite'
510+ diskSizeGB : 128
511+ managedDisk : {
512+ storageAccountType : 'Premium_LRS'
513+ }
514+ }
515+ encryptionAtHost : false // Some Azure subscriptions do not support encryption at host
516+ location : solutionLocation
517+ tags : tags
414518 }
415519 dependsOn : (enableMonitoring && !useExistingLogAnalytics ) ? [logAnalyticsWorkspace ] : []
416520}
0 commit comments