@@ -328,290 +328,6 @@ module userAssignedIdentity 'br/public:avm/res/managed-identity/user-assigned-id
328328 }
329329}
330330
331- // ========== Network Security Groups ========== //
332- // WAF best practices for virtual networks: https://learn.microsoft.com/en-us/azure/well-architected/service-guides/virtual-network
333- // WAF recommendations for networking and connectivity: https://learn.microsoft.com/en-us/azure/well-architected/security/networking
334- // var networkSecurityGroupBackendResourceName = 'nsg-${solutionSuffix}-backend'
335- // module networkSecurityGroupBackend 'br/public:avm/res/network/network-security-group:0.5.1' = if (enablePrivateNetworking) {
336- // name: take('avm.res.network.network-security-group.${networkSecurityGroupBackendResourceName}', 64)
337- // params: {
338- // name: networkSecurityGroupBackendResourceName
339- // location: location
340- // tags: tags
341- // enableTelemetry: enableTelemetry
342- // diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
343- // securityRules: [
344- // {
345- // name: 'deny-hop-outbound'
346- // properties: {
347- // access: 'Deny'
348- // destinationAddressPrefix: '*'
349- // destinationPortRanges: [
350- // '22'
351- // '3389'
352- // ]
353- // direction: 'Outbound'
354- // priority: 200
355- // protocol: 'Tcp'
356- // sourceAddressPrefix: 'VirtualNetwork'
357- // sourcePortRange: '*'
358- // }
359- // }
360- // ]
361- // }
362- // }
363-
364- // var networkSecurityGroupBastionResourceName = 'nsg-${solutionSuffix}-bastion'
365- // module networkSecurityGroupBastion 'br/public:avm/res/network/network-security-group:0.5.1' = if (enablePrivateNetworking) {
366- // name: take('avm.res.network.network-security-group.${networkSecurityGroupBastionResourceName}', 64)
367- // params: {
368- // name: networkSecurityGroupBastionResourceName
369- // location: location
370- // tags: tags
371- // enableTelemetry: enableTelemetry
372- // diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
373- // securityRules: [
374- // {
375- // name: 'AllowHttpsInBound'
376- // properties: {
377- // protocol: 'Tcp'
378- // sourcePortRange: '*'
379- // sourceAddressPrefix: 'Internet'
380- // destinationPortRange: '443'
381- // destinationAddressPrefix: '*'
382- // access: 'Allow'
383- // priority: 100
384- // direction: 'Inbound'
385- // }
386- // }
387- // {
388- // name: 'AllowGatewayManagerInBound'
389- // properties: {
390- // protocol: 'Tcp'
391- // sourcePortRange: '*'
392- // sourceAddressPrefix: 'GatewayManager'
393- // destinationPortRange: '443'
394- // destinationAddressPrefix: '*'
395- // access: 'Allow'
396- // priority: 110
397- // direction: 'Inbound'
398- // }
399- // }
400- // {
401- // name: 'AllowLoadBalancerInBound'
402- // properties: {
403- // protocol: 'Tcp'
404- // sourcePortRange: '*'
405- // sourceAddressPrefix: 'AzureLoadBalancer'
406- // destinationPortRange: '443'
407- // destinationAddressPrefix: '*'
408- // access: 'Allow'
409- // priority: 120
410- // direction: 'Inbound'
411- // }
412- // }
413- // {
414- // name: 'AllowBastionHostCommunicationInBound'
415- // properties: {
416- // protocol: '*'
417- // sourcePortRange: '*'
418- // sourceAddressPrefix: 'VirtualNetwork'
419- // destinationPortRanges: [
420- // '8080'
421- // '5701'
422- // ]
423- // destinationAddressPrefix: 'VirtualNetwork'
424- // access: 'Allow'
425- // priority: 130
426- // direction: 'Inbound'
427- // }
428- // }
429- // {
430- // name: 'DenyAllInBound'
431- // properties: {
432- // protocol: '*'
433- // sourcePortRange: '*'
434- // sourceAddressPrefix: '*'
435- // destinationPortRange: '*'
436- // destinationAddressPrefix: '*'
437- // access: 'Deny'
438- // priority: 1000
439- // direction: 'Inbound'
440- // }
441- // }
442- // {
443- // name: 'AllowSshRdpOutBound'
444- // properties: {
445- // protocol: 'Tcp'
446- // sourcePortRange: '*'
447- // sourceAddressPrefix: '*'
448- // destinationPortRanges: [
449- // '22'
450- // '3389'
451- // ]
452- // destinationAddressPrefix: 'VirtualNetwork'
453- // access: 'Allow'
454- // priority: 100
455- // direction: 'Outbound'
456- // }
457- // }
458- // {
459- // name: 'AllowAzureCloudCommunicationOutBound'
460- // properties: {
461- // protocol: 'Tcp'
462- // sourcePortRange: '*'
463- // sourceAddressPrefix: '*'
464- // destinationPortRange: '443'
465- // destinationAddressPrefix: 'AzureCloud'
466- // access: 'Allow'
467- // priority: 110
468- // direction: 'Outbound'
469- // }
470- // }
471- // {
472- // name: 'AllowBastionHostCommunicationOutBound'
473- // properties: {
474- // protocol: '*'
475- // sourcePortRange: '*'
476- // sourceAddressPrefix: 'VirtualNetwork'
477- // destinationPortRanges: [
478- // '8080'
479- // '5701'
480- // ]
481- // destinationAddressPrefix: 'VirtualNetwork'
482- // access: 'Allow'
483- // priority: 120
484- // direction: 'Outbound'
485- // }
486- // }
487- // {
488- // name: 'AllowGetSessionInformationOutBound'
489- // properties: {
490- // protocol: '*'
491- // sourcePortRange: '*'
492- // sourceAddressPrefix: '*'
493- // destinationAddressPrefix: 'Internet'
494- // destinationPortRanges: [
495- // '80'
496- // '443'
497- // ]
498- // access: 'Allow'
499- // priority: 130
500- // direction: 'Outbound'
501- // }
502- // }
503- // {
504- // name: 'DenyAllOutBound'
505- // properties: {
506- // protocol: '*'
507- // sourcePortRange: '*'
508- // destinationPortRange: '*'
509- // sourceAddressPrefix: '*'
510- // destinationAddressPrefix: '*'
511- // access: 'Deny'
512- // priority: 1000
513- // direction: 'Outbound'
514- // }
515- // }
516- // ]
517- // }
518- // }
519-
520- // var networkSecurityGroupAdministrationResourceName = 'nsg-${solutionSuffix}-administration'
521- // module networkSecurityGroupAdministration 'br/public:avm/res/network/network-security-group:0.5.1' = if (enablePrivateNetworking) {
522- // name: take('avm.res.network.network-security-group.${networkSecurityGroupAdministrationResourceName}', 64)
523- // params: {
524- // name: networkSecurityGroupAdministrationResourceName
525- // location: location
526- // tags: tags
527- // enableTelemetry: enableTelemetry
528- // diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
529- // securityRules: [
530- // {
531- // name: 'deny-hop-outbound'
532- // properties: {
533- // access: 'Deny'
534- // destinationAddressPrefix: '*'
535- // destinationPortRanges: [
536- // '22'
537- // '3389'
538- // ]
539- // direction: 'Outbound'
540- // priority: 200
541- // protocol: 'Tcp'
542- // sourceAddressPrefix: 'VirtualNetwork'
543- // sourcePortRange: '*'
544- // }
545- // }
546- // ]
547- // }
548- // }
549-
550- // var networkSecurityGroupContainersResourceName = 'nsg-${solutionSuffix}-containers'
551- // module networkSecurityGroupContainers 'br/public:avm/res/network/network-security-group:0.5.1' = if (enablePrivateNetworking) {
552- // name: take('avm.res.network.network-security-group.${networkSecurityGroupContainersResourceName}', 64)
553- // params: {
554- // name: networkSecurityGroupContainersResourceName
555- // location: location
556- // tags: tags
557- // enableTelemetry: enableTelemetry
558- // diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
559- // securityRules: [
560- // {
561- // name: 'deny-hop-outbound'
562- // properties: {
563- // access: 'Deny'
564- // destinationAddressPrefix: '*'
565- // destinationPortRanges: [
566- // '22'
567- // '3389'
568- // ]
569- // direction: 'Outbound'
570- // priority: 200
571- // protocol: 'Tcp'
572- // sourceAddressPrefix: 'VirtualNetwork'
573- // sourcePortRange: '*'
574- // }
575- // }
576- // ]
577- // }
578- // }
579-
580- // var networkSecurityGroupWebsiteResourceName = 'nsg-${solutionSuffix}-website'
581- // module networkSecurityGroupWebsite 'br/public:avm/res/network/network-security-group:0.5.1' = if (enablePrivateNetworking) {
582- // name: take('avm.res.network.network-security-group.${networkSecurityGroupWebsiteResourceName}', 64)
583- // params: {
584- // name: networkSecurityGroupWebsiteResourceName
585- // location: location
586- // tags: tags
587- // enableTelemetry: enableTelemetry
588- // diagnosticSettings: enableMonitoring ? [{ workspaceResourceId: logAnalyticsWorkspaceResourceId }] : null
589- // securityRules: [
590- // {
591- // name: 'deny-hop-outbound'
592- // properties: {
593- // access: 'Deny'
594- // destinationAddressPrefix: '*'
595- // destinationPortRanges: [
596- // '22'
597- // '3389'
598- // ]
599- // direction: 'Outbound'
600- // priority: 200
601- // protocol: 'Tcp'
602- // sourceAddressPrefix: 'VirtualNetwork'
603- // sourcePortRange: '*'
604- // }
605- // }
606- // ]
607- // }
608- // }
609-
610- // ========== Virtual Network ========== //
611- // WAF best practices for virtual networks: https://learn.microsoft.com/en-us/azure/well-architected/service-guides/virtual-network
612- // WAF recommendations for networking and connectivity: https://learn.microsoft.com/en-us/azure/well-architected/security/networking
613-
614- // Virtual Network configuration is now handled by the virtualNetwork.bicep module
615331var virtualNetworkResourceName = 'vnet-${solutionSuffix }'
616332module virtualNetwork 'modules/virtualNetwork.bicep' = if (enablePrivateNetworking ) {
617333 name : take ('module.virtualNetwork.${solutionSuffix }' , 64 )
@@ -626,51 +342,6 @@ module virtualNetwork 'modules/virtualNetwork.bicep' = if (enablePrivateNetworki
626342 }
627343}
628344
629- /*
630- subnets: [
631- {
632- name: 'backend'
633- addressPrefix: '10.0.0.0/27'
634- //defaultOutboundAccess: false TODO: check this configuration for a more restricted outbound access
635- networkSecurityGroupResourceId: networkSecurityGroupBackend!.outputs.resourceId
636- }
637- {
638- name: 'administration'
639- addressPrefix: '10.0.0.32/27'
640- networkSecurityGroupResourceId: networkSecurityGroupAdministration!.outputs.resourceId
641- //defaultOutboundAccess: false TODO: check this configuration for a more restricted outbound access
642- //natGatewayResourceId: natGateway.outputs.resourceId
643- }
644- {
645- // For Azure Bastion resources deployed on or after November 2, 2021, the minimum AzureBastionSubnet size is /26 or larger (/25, /24, etc.).
646- // https://learn.microsoft.com/en-us/azure/bastion/configuration-settings#subnet
647- name: 'AzureBastionSubnet' //This exact name is required for Azure Bastion
648- addressPrefix: '10.0.0.64/26'
649- networkSecurityGroupResourceId: networkSecurityGroupBastion!.outputs.resourceId
650- }
651- {
652- // If you use your own vnw, you need to provide a subnet that is dedicated exclusively to the Container App environment you deploy. This subnet isn't available to other services
653- // https://learn.microsoft.com/en-us/azure/container-apps/networking?tabs=workload-profiles-env%2Cazure-cli#custom-vnw-configuration
654- name: 'containers'
655- addressPrefix: '10.0.2.0/23' //subnet of size /23 is required for container app
656- delegation: 'Microsoft.App/environments'
657- networkSecurityGroupResourceId: networkSecurityGroupContainers!.outputs.resourceId
658- privateEndpointNetworkPolicies: 'Enabled'
659- privateLinkServiceNetworkPolicies: 'Enabled'
660- }
661- {
662- // If you use your own vnw, you need to provide a subnet that is dedicated exclusively to the App Environment you deploy. This subnet isn't available to other services
663- // https://learn.microsoft.com/en-us/azure/app-service/overview-vnet-integration#subnet-requirements
664- name: 'webserverfarm'
665- addressPrefix: '10.0.4.0/27' //When you're creating subnets in Azure portal as part of integrating with the virtual network, a minimum size of /27 is required
666- delegation: 'Microsoft.Web/serverfarms'
667- networkSecurityGroupResourceId: networkSecurityGroupWebsite!.outputs.resourceId
668- privateEndpointNetworkPolicies: 'Enabled'
669- privateLinkServiceNetworkPolicies: 'Enabled'
670- }
671- ]
672- */
673-
674345var bastionResourceName = 'bas-${solutionSuffix }'
675346// ========== Bastion host ========== //
676347// WAF best practices for virtual networks: https://learn.microsoft.com/en-us/azure/well-architected/service-guides/virtual-network
0 commit comments