Gallery › Network › Azure Landing Zones Library
Azure Firewall should have a default Firewall Policy
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This policy denies the creation of Azure Firewall without a default Firewall Policy.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-AzFw-Without-Policy.alz_policy_definition.json · 52 lines
{
"name": "Deny-AzFw-Without-Policy",
"properties": {
"description": "This policy denies the creation of Azure Firewall without a default Firewall Policy.",
"displayName": "Azure Firewall should have a default Firewall Policy",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Network",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.Network/azureFirewalls",
"field": "type"
},
{
"exists": "false",
"field": "Microsoft.Network/azureFirewalls/firewallPolicy.id"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-AzFw-Without-Policy.bylaw.ps1 · 28 lines
# Converted from Deny-AzFw-Without-Policy.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-AzFw-Without-Policy' {
Properties @{
DisplayName = 'Azure Firewall should have a default Firewall Policy'
Description = 'This policy denies the creation of Azure Firewall without a default Firewall Policy.'
Category = 'Network'
Version = '1.0.0'
Mode = 'All'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Network/azureFirewalls' {
Require 'firewallPolicy.id exists' {
Field firewallPolicy.id | Must -Exist
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-AzFw-Without-Policy.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw