Skip to content

Commit

Permalink
feat: Add SNAT property to firewall resources (#854)
Browse files Browse the repository at this point in the history
* Add SNAT property to firewall policies

* Generate Parameter Markdowns [oZakari/3ab7cc22]

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
oZakari and github-actions[bot] authored Sep 6, 2024
1 parent 3ab7cc2 commit 79b1fbb
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ parAzFirewallEnabled | No | Switch to enable/disable Azure Firewall deploy
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.
parAzFirewallPoliciesName | No | Azure Firewall Policies Name.
parAzFirewallPoliciesAutoLearn | No | The operation mode for automatically learning private ranges to not be SNAT.
parAzFirewallPoliciesPrivateRanges | No | Private IP addresses/IP ranges to which traffic will not be SNAT.
parAzFirewallTier | No | Azure Firewall Tier associated with the Firewall to deploy.
parAzFirewallIntelMode | No | The Azure Firewall Threat Intelligence Mode. If not set, the default value is Alert.
parAzFirewallCustomPublicIps | No | Optional List of Custom Public IPs, which are assigned to firewalls ipConfigurations.
Expand Down Expand Up @@ -269,6 +271,22 @@ Azure Firewall Policies Name.

- Default value: `[format('{0}-azfwpolicy-{1}', parameters('parCompanyPrefix'), parameters('parLocation'))]`

### parAzFirewallPoliciesAutoLearn

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

The operation mode for automatically learning private ranges to not be SNAT.

- Default value: `Disabled`

### parAzFirewallPoliciesPrivateRanges

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Private IP addresses/IP ranges to which traffic will not be SNAT.

- Allowed values: `Disabled`, `Enabled`

### parAzFirewallTier

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
Expand Down Expand Up @@ -630,6 +648,12 @@ outBastionNsgName | string |
"parAzFirewallPoliciesName": {
"value": "[format('{0}-azfwpolicy-{1}', parameters('parCompanyPrefix'), parameters('parLocation'))]"
},
"parAzFirewallPoliciesAutoLearn": {
"value": "Disabled"
},
"parAzFirewallPoliciesPrivateRanges": {
"value": []
},
"parAzFirewallTier": {
"value": "Standard"
},
Expand Down
19 changes: 19 additions & 0 deletions infra-as-code/bicep/modules/hubNetworking/hubNetworking.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ param parGlobalResourceLock lockType = {
notes: 'This lock was created by the ALZ Bicep Hub Networking Module.'
}


@sys.description('The IP address range for Hub Network.')
param parHubNetworkAddressPrefix string = '10.10.0.0/16'

Expand Down Expand Up @@ -166,6 +167,18 @@ param parAzFirewallPoliciesEnabled bool = true
@sys.description('Azure Firewall Policies Name.')
param parAzFirewallPoliciesName string = '${parCompanyPrefix}-azfwpolicy-${parLocation}'

@description('The operation mode for automatically learning private ranges to not be SNAT.')
param parAzFirewallPoliciesAutoLearn string = 'Disabled'
@allowed([
'Disabled'
'Enabled'
])

@description('Private IP addresses/IP ranges to which traffic will not be SNAT.')
param parAzFirewallPoliciesPrivateRanges array = []

@sys.description('Private IP addresses/IP ranges to which traffic will not be SNAT.')

@sys.description('Azure Firewall Tier associated with the Firewall to deploy.')
@allowed([
'Basic'
Expand Down Expand Up @@ -863,6 +876,12 @@ resource resFirewallPolicies 'Microsoft.Network/firewallPolicies@2023-02-01' = i
sku: {
tier: parAzFirewallTier
}
snat: !empty(parAzFirewallPoliciesPrivateRanges)
? {
autoLearnPrivateRanges: parAzFirewallPoliciesAutoLearn
privateRanges: parAzFirewallPoliciesPrivateRanges
}
: null
threatIntelMode: 'Alert'
} : {
dnsSettings: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ parVpnGatewayName | No | VPN Gateway Name.
parExpressRouteGatewayName | No | ExpressRoute Gateway Name.
parAzFirewallName | No | Azure Firewall Name.
parAzFirewallPoliciesName | No | Azure Firewall Policies Name.
parAzFirewallPoliciesAutoLearn | No | The operation mode for automatically learning private ranges to not be SNAT.
parAzFirewallPoliciesPrivateRanges | No | Private IP addresses/IP ranges to which traffic will not be SNAT.
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.
parVpnGatewayScaleUnit | No | The scale unit for this VPN Gateway.
parExpressRouteGatewayScaleUnit | No | The scale unit for this ExpressRoute Gateway.
Expand Down Expand Up @@ -200,6 +202,22 @@ Azure Firewall Policies Name.

- Default value: `[format('{0}-azfwpolicy', parameters('parCompanyPrefix'))]`

### parAzFirewallPoliciesAutoLearn

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

The operation mode for automatically learning private ranges to not be SNAT.

- Default value: `Disabled`

### parAzFirewallPoliciesPrivateRanges

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)

Private IP addresses/IP ranges to which traffic will not be SNAT.

- Allowed values: `Disabled`, `Enabled`

### parAzureFirewallLock

![Parameter Setting](https://img.shields.io/badge/parameter-optional-green?style=flat-square)
Expand Down Expand Up @@ -433,6 +451,12 @@ outAzFwPrivateIps | array |
"parAzFirewallPoliciesName": {
"value": "[format('{0}-azfwpolicy', parameters('parCompanyPrefix'))]"
},
"parAzFirewallPoliciesAutoLearn": {
"value": "Disabled"
},
"parAzFirewallPoliciesPrivateRanges": {
"value": []
},
"parAzureFirewallLock": {
"value": {
"kind": "None",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ param parAzFirewallName string = '${parCompanyPrefix}-fw'
@sys.description('Azure Firewall Policies Name.')
param parAzFirewallPoliciesName string = '${parCompanyPrefix}-azfwpolicy'

@description('The operation mode for automatically learning private ranges to not be SNAT.')
param parAzFirewallPoliciesAutoLearn string = 'Disabled'
@allowed([
'Disabled'
'Enabled'
])

@description('Private IP addresses/IP ranges to which traffic will not be SNAT.')
param parAzFirewallPoliciesPrivateRanges array = []

@sys.description('''Resource Lock Configuration for Azure Firewall.
- `kind` - The lock settings of the service which can be CanNotDelete, ReadOnly, or None.
Expand Down Expand Up @@ -487,6 +497,12 @@ resource resFirewallPolicies 'Microsoft.Network/firewallPolicies@2023-02-01' = [
sku: {
tier: hub.parAzFirewallTier
}
snat: !empty(parAzFirewallPoliciesPrivateRanges)
? {
autoLearnPrivateRanges: parAzFirewallPoliciesAutoLearn
privateRanges: parAzFirewallPoliciesPrivateRanges
}
: null
threatIntelMode: 'Alert'
} : {
dnsSettings: {
Expand Down

0 comments on commit 79b1fbb

Please sign in to comment.