Skip to content

Commit

Permalink
Add gateway udt and add allowed values
Browse files Browse the repository at this point in the history
  • Loading branch information
oZakari committed Jan 23, 2025
1 parent 4a55500 commit 2c941aa
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 153 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Parameter name | Required | Description
parLocation | No | The Azure Region to deploy the resources into.
parCompanyPrefix | No | Prefix value which will be prepended to all resource names.
parHubNetworkName | No | Name for Hub Network.
parGlobalResourceLock | No | Global Resource Lock Configuration used for all resources deployed in this module. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parGlobalResourceLock | No | Global Resource Lock Configuration used for all resources deployed in this module. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parHubNetworkAddressPrefix | No | The IP address range for Hub Network.
parSubnets | No | The name, IP address range, network security group, route table and delegation serviceName for each subnet in the virtual networks.
parDnsServerIps | No | Array of DNS Server IP addresses for VNet.
parVirtualNetworkLock | No | Resource Lock Configuration for Virtual Network. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parVirtualNetworkLock | No | Resource Lock Configuration for Virtual Network. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parPublicIpSku | No | Public IP Address SKU.
parPublicIpPrefix | No | Optional Prefix for Public IPs. Include a succedent dash if required. Example: prefix-
parPublicIpSuffix | No | Optional Suffix for Public IPs. Include a preceding dash if required. Example: -suffix
Expand All @@ -22,10 +22,10 @@ parAzBastionName | No | Name Associated with Bastion Service.
parAzBastionSku | No | Azure Bastion SKU.
parAzBastionTunneling | No | Switch to enable/disable Bastion native client support. This is only supported when the Standard SKU is used for Bastion as documented here: https://learn.microsoft.com/azure/bastion/native-client
parAzBastionNsgName | No | Name for Azure Bastion Subnet NSG.
parBastionLock | No | Resource Lock Configuration for Bastion. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parBastionLock | No | Resource Lock Configuration for Bastion. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parDdosEnabled | No | Switch to enable/disable DDoS Network Protection deployment.
parDdosPlanName | No | DDoS Plan Name.
parDdosLock | No | Resource Lock Configuration for DDoS Plan. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parDdosLock | No | Resource Lock Configuration for DDoS Plan. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parAzFirewallEnabled | No | Switch to enable/disable Azure Firewall deployment.
parAzFirewallName | No | Azure Firewall Name.
parAzFirewallPoliciesEnabled | No | Set this to true for the initial deployment as one firewall policy is required. Set this to false in subsequent deployments if using custom policies.
Expand All @@ -40,21 +40,21 @@ parAzErGatewayAvailabilityZones | No | Availability Zones to deploy the VP
parAzVpnGatewayAvailabilityZones | No | Availability Zones to deploy the VPN/ER PIP across. Region must support Availability Zones to use. If it does not then leave empty. Ensure that you select a zonal SKU for the ER/VPN Gateway if using Availability Zones for the PIP.
parAzFirewallDnsProxyEnabled | No | Switch to enable/disable Azure Firewall DNS Proxy.
parAzFirewallDnsServers | No | Array of custom DNS servers used by Azure Firewall
parAzureFirewallLock | No | Resource Lock Configuration for Azure Firewall. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parAzureFirewallLock | No | Resource Lock Configuration for Azure Firewall. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parHubRouteTableName | No | Name of Route table to create for the default route of Hub.
parDisableBgpRoutePropagation | No | Switch to enable/disable BGP Propagation on route table.
parHubRouteTableLock | No | Resource Lock Configuration for Hub Route Table. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parHubRouteTableLock | No | Resource Lock Configuration for Hub Route Table. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parPrivateDnsZonesEnabled | No | Switch to enable/disable Private DNS Zones deployment.
parPrivateDnsZonesResourceGroup | No | Resource Group Name for Private DNS Zones.
parPrivateDnsZones | No | Array of DNS Zones to provision and link to Hub Virtual Network. Default: All known Azure Private DNS Zones, baked into underlying AVM module see: https://github.com/Azure/bicep-registry-modules/tree/main/avm/ptn/network/private-link-private-dns-zones#parameter-privatelinkprivatednszones
parVirtualNetworkIdToLinkFailover | No | Resource ID of Failover VNet for Private DNS Zone VNet Failover Links
parVirtualNetworkResourceIdsToLinkTo | No | Array of Resource IDs of VNets to link to Private DNS Zones. Hub VNet is automatically included by module.
parPrivateDNSZonesLock | No | Resource Lock Configuration for Private DNS Zone(s). - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parPrivateDNSZonesLock | No | Resource Lock Configuration for Private DNS Zone(s). - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parVpnGatewayEnabled | No | Switch to enable/disable VPN virtual network gateway deployment.
parVpnGatewayConfig | No | Configuration for VPN virtual network gateway to be deployed.
parExpressRouteGatewayEnabled | No | Switch to enable/disable ExpressRoute virtual network gateway deployment.
parExpressRouteGatewayConfig | No | Configuration for ExpressRoute virtual network gateway to be deployed.
parVirtualNetworkGatewayLock | No | Resource Lock Configuration for ExpressRoute Virtual Network Gateway. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parVirtualNetworkGatewayLock | No | Resource Lock Configuration for ExpressRoute Virtual Network Gateway. - `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None. - `notes` - Notes about this lock.
parTags | No | Tags you would like to be applied to all resources in this module.
parTelemetryOptOut | No | Set Parameter to true to Opt-out of deployment telemetry.
parBastionOutboundSshRdpPorts | No | Define outbound destination ports or ranges for SSH or RDP that you want to access from Azure Bastion.
Expand Down Expand Up @@ -454,7 +454,7 @@ Switch to enable/disable VPN virtual network gateway deployment.

Configuration for VPN virtual network gateway to be deployed.

- Default value: `@{name=[format('{0}-Vpn-Gateway', parameters('parCompanyPrefix'))]; gatewayType=Vpn; sku=VpnGw1; vpnType=RouteBased; generation=Generation1; enableBgp=False; activeActive=False; enableBgpRouteTranslationForNat=False; enableDnsForwarding=False; bgpPeeringAddress=; bgpsettings=; vpnClientConfiguration=; ipConfigurationName=vnetGatewayConfig; ipConfigurationActiveActiveName=vnetGatewayConfig2}`
- Default value: `@{name=[format('{0}-Vpn-Gateway', parameters('parCompanyPrefix'))]; gatewayType=Vpn; sku=VpnGw1AZ; vpnType=RouteBased; generation=Generation1; enableBgp=False; activeActive=False; enableBgpRouteTranslationForNat=False; enableDnsForwarding=False; bgpPeeringAddress=; bgpSettings=; vpnClientConfiguration=; ipConfigurationName=vnetGatewayConfig; ipConfigurationActiveActiveName=vnetGatewayConfig2}`

### parExpressRouteGatewayEnabled

Expand All @@ -470,7 +470,7 @@ Switch to enable/disable ExpressRoute virtual network gateway deployment.

Configuration for ExpressRoute virtual network gateway to be deployed.

- Default value: `@{name=[format('{0}-ExpressRoute-Gateway', parameters('parCompanyPrefix'))]; gatewayType=ExpressRoute; sku=ErGw1AZ; vpnType=RouteBased; vpnGatewayGeneration=None; enableBgp=False; activeActive=False; enableBgpRouteTranslationForNat=False; enableDnsForwarding=False; bgpPeeringAddress=; bgpsettings=; ipConfigurationName=vnetGatewayConfig; ipConfigurationActiveActiveName=vnetGatewayConfig2}`
- Default value: `@{name=[format('{0}-ExpressRoute-Gateway', parameters('parCompanyPrefix'))]; gatewayType=ExpressRoute; sku=ErGw1AZ; vpnType=RouteBased; vpnGatewayGeneration=None; enableBgp=False; activeActive=False; enableBgpRouteTranslationForNat=False; enableDnsForwarding=False; bgpPeeringAddress=; bgpSettings=; ipConfigurationName=vnetGatewayConfig; ipConfigurationActiveActiveName=vnetGatewayConfig2}`

### parVirtualNetworkGatewayLock

Expand Down Expand Up @@ -720,15 +720,15 @@ outBastionNsgName | string |
"value": {
"name": "[format('{0}-Vpn-Gateway', parameters('parCompanyPrefix'))]",
"gatewayType": "Vpn",
"sku": "VpnGw1",
"sku": "VpnGw1AZ",
"vpnType": "RouteBased",
"generation": "Generation1",
"vpnGatewayGeneration": "Generation1",
"enableBgp": false,
"activeActive": false,
"enableBgpRouteTranslationForNat": false,
"enableDnsForwarding": false,
"bgpPeeringAddress": "",
"bgpsettings": {
"bgpSettings": {
"asn": 65515,
"bgpPeeringAddress": "",
"peerWeight": 5
Expand All @@ -753,10 +753,10 @@ outBastionNsgName | string |
"enableBgpRouteTranslationForNat": false,
"enableDnsForwarding": false,
"bgpPeeringAddress": "",
"bgpsettings": {
"asn": "65515",
"bgpSettings": {
"asn": 65515,
"bgpPeeringAddress": "",
"peerWeight": "5"
"peerWeight": 5
},
"ipConfigurationName": "vnetGatewayConfig",
"ipConfigurationActiveActiveName": "vnetGatewayConfig2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
metadata name = 'ALZ Bicep - Hub Networking Module'
metadata description = 'ALZ Bicep Module used to set up Hub Networking'
metadata name = 'ALZ Bicep - Hub Networking Multi-Region Module'
metadata description = 'ALZ Bicep Module used to set up Hub Networking in two regions.'

type subnetOptionsType = ({
@description('Name of subnet.')
Expand All @@ -18,6 +18,61 @@ type subnetOptionsType = ({
delegation: string?
})[]

type virtualNetworkGatewayOptionsType = {
@description('Name of the gateway.')
name: string

@description('Type of gateway.')
gatewayType: ('Vpn' | 'ExpressRoute')

@description('SKU of the gateway.')
sku: ('Basic' | 'VpnGw1AZAZ' | 'VpnGw2AZ' | 'VpnGw3AZ' | 'VpnGw4AZ' | 'VpnGw5AZ' | 'ErGw1AZ' | 'ErGw2AZ' | 'ErGw3AZ' | 'ErGwScale' | 'HighPerformance' | 'Standard' | 'UltraPerformance')

@description('Type of VPN.')
vpnType: string

@description('Generation of the VPN Gateway.')
vpnGatewayGeneration: ('Generation1' | 'Generation2' | 'None' )

@description('Enable BGP on the gateway.')
enableBgp: bool

@description('Enable Active-Active on the gateway.')
activeActive: bool

@description('Enable BGP Route Translation for NAT on the gateway.')
enableBgpRouteTranslationForNat: bool

@description('Enable DNS Forwarding on the gateway.')
enableDnsForwarding: bool

@description('BGP Peering Address for the gateway.')
bgpPeeringAddress: string?

@description('BGP Settings for the gateway.')
bgpSettings: {
@minValue(0)
@maxValue(4294967295)
@description('ASN for the gateway.')
asn: int

@description('BGP Peering Address for the gateway.')
bgpPeeringAddress: string?

@description('Peer Weight for the gateway.')
peerWeight: int
}

@description('VPN Client Configuration for the gateway.')
vpnClientConfiguration: object?

@description('Name of the IP Configuration for the gateway.')
ipConfigurationName: string

@description('Name of the Active-Active IP Configuration for the gateway.')
ipConfigurationActiveActiveName: string
}

type lockType = {
@description('Optional. Specify the name of lock.')
name: string?
Expand Down Expand Up @@ -437,18 +492,18 @@ param parVpnGatewayEnabledSecondaryLocation bool = true

//ASN must be 65515 if deploying VPN & ER for co-existence to work: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-howto-coexist-resource-manager#limits-and-limitations
@sys.description('Configuration for VPN virtual network gateway to be deployed.')
param parVpnGatewayConfig object = {
param parVpnGatewayConfig virtualNetworkGatewayOptionsType = {
name: '${parCompanyPrefix}-Vpn-Gateway-${parLocation}'
gatewayType: 'Vpn'
sku: 'VpnGw1'
sku: 'ErGw1AZ'
vpnType: 'RouteBased'
generation: 'Generation1'
vpnGatewayGeneration: 'Generation1'
enableBgp: false
activeActive: false
enableBgpRouteTranslationForNat: false
enableDnsForwarding: false
bgpPeeringAddress: ''
bgpsettings: {
bgpSettings: {
asn: 65515
bgpPeeringAddress: ''
peerWeight: 5
Expand All @@ -460,18 +515,18 @@ param parVpnGatewayConfig object = {

//ASN must be 65515 if deploying VPN & ER for co-existence to work: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-howto-coexist-resource-manager#limits-and-limitations
@sys.description('Configuration for VPN virtual network gateway to be deployed in secondary location.')
param parVpnGatewayConfigSecondaryLocation object = {
param parVpnGatewayConfigSecondaryLocation virtualNetworkGatewayOptionsType = {
name: '${parCompanyPrefix}-Vpn-Gateway-${parSecondaryLocation}'
gatewayType: 'Vpn'
sku: 'VpnGw1'
sku: 'VpnGw1AZAZ'
vpnType: 'RouteBased'
generation: 'Generation1'
vpnGatewayGeneration: 'Generation1'
enableBgp: false
activeActive: false
enableBgpRouteTranslationForNat: false
enableDnsForwarding: false
bgpPeeringAddress: ''
bgpsettings: {
bgpSettings: {
asn: 65515
bgpPeeringAddress: ''
peerWeight: 5
Expand All @@ -488,7 +543,7 @@ param parExpressRouteGatewayEnabled bool = true
param parExpressRouteGatewayEnabledSecondaryLocation bool = true

@sys.description('Configuration for ExpressRoute virtual network gateway to be deployed.')
param parExpressRouteGatewayConfig object = {
param parExpressRouteGatewayConfig virtualNetworkGatewayOptionsType = {
name: '${parCompanyPrefix}-ExpressRoute-Gateway'
gatewayType: 'ExpressRoute'
sku: 'ErGw1AZ'
Expand All @@ -499,17 +554,17 @@ param parExpressRouteGatewayConfig object = {
enableBgpRouteTranslationForNat: false
enableDnsForwarding: false
bgpPeeringAddress: ''
bgpsettings: {
asn: '65515'
bgpSettings: {
asn: 65515
bgpPeeringAddress: ''
peerWeight: '5'
peerWeight: 5
}
ipConfigurationName: 'vnetGatewayConfig'
ipConfigurationActiveActiveName: 'vnetGatewayConfig2'
}

@sys.description('Configuration for ExpressRoute virtual network gateway to be deployed in secondary location.')
param parExpressRouteGatewayConfigSecondaryLocation object = {
param parExpressRouteGatewayConfigSecondaryLocation virtualNetworkGatewayOptionsType = {
name: '${parCompanyPrefix}-ExpressRoute-Gateway'
gatewayType: 'ExpressRoute'
sku: 'ErGw1AZ'
Expand All @@ -520,10 +575,10 @@ param parExpressRouteGatewayConfigSecondaryLocation object = {
enableBgpRouteTranslationForNat: false
enableDnsForwarding: false
bgpPeeringAddress: ''
bgpsettings: {
asn: '65515'
bgpSettings: {
asn: 65515
bgpPeeringAddress: ''
peerWeight: '5'
peerWeight: 5
}
ipConfigurationName: 'vnetGatewayConfig'
ipConfigurationActiveActiveName: 'vnetGatewayConfig2'
Expand Down Expand Up @@ -1406,7 +1461,7 @@ resource resGateway 'Microsoft.Network/virtualNetworkGateways@2024-01-01' = [
enableDnsForwarding: gateway.enableDnsForwarding
bgpSettings: (gateway.enableBgp) ? gateway.bgpSettings : null
gatewayType: gateway.gatewayType
vpnGatewayGeneration: (toLower(gateway.gatewayType) == 'vpn') ? gateway.generation : 'None'
vpnGatewayGeneration: (toLower(gateway.gatewayType) == 'vpn') ? gateway.vpnGatewayGeneration : 'None'
vpnType: gateway.vpnType
sku: {
name: gateway.sku
Expand Down Expand Up @@ -1476,7 +1531,7 @@ resource resGatewaySecondaryLocation 'Microsoft.Network/virtualNetworkGateways@2
enableDnsForwarding: gateway.enableDnsForwarding
bgpSettings: (gateway.enableBgp) ? gateway.bgpSettings : null
gatewayType: gateway.gatewayType
vpnGatewayGeneration: (toLower(gateway.gatewayType) == 'vpn') ? gateway.generation : 'None'
vpnGatewayGeneration: (toLower(gateway.gatewayType) == 'vpn') ? gateway.vpnGatewayGeneration : 'None'
vpnType: gateway.vpnType
sku: {
name: gateway.sku
Expand Down
Loading

0 comments on commit 2c941aa

Please sign in to comment.