Bylaw

Gallery › Network › Azure built-in policies

Azure Firewall Policy Analytics should be Enabled

Converted Policy Audit Disabled Mode Indexed Version 1.0.0

Enabling Policy Analytics provides enhanced visibility into traffic flowing through Azure Firewall, enabling the optimization of your firewall configuration without impacting your application performance

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONAzureFirewall_EnablePolicyAnalytics_Audit.json · 49 lines
{
  "properties": {
    "displayName": "Azure Firewall Policy Analytics should be Enabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Enabling Policy Analytics provides enhanced visibility into traffic flowing through Azure Firewall, enabling the optimization of your firewall configuration without impacting your application performance",
    "metadata": {
      "version": "1.0.0",
      "category": "Network"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Network/firewallPolicies"
          },
          {
            "field": "Microsoft.Network/firewallPolicies/insights.isEnabled",
            "exists": "false"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/dfb5ac92-ce74-4dbc-81fa-87243e62d5d3",
  "name": "dfb5ac92-ce74-4dbc-81fa-87243e62d5d3"
}
Bylawdfb5ac92-ce74-4dbc-81fa-87243e62d5d3.bylaw.ps1 · 28 lines
# Converted from AzureFirewall_EnablePolicyAnalytics_Audit.json by ConvertTo-Bylaw.
Policy 'dfb5ac92-ce74-4dbc-81fa-87243e62d5d3' {

    Properties @{
        DisplayName   = 'Azure Firewall Policy Analytics should be Enabled'
        Description   = 'Enabling Policy Analytics provides enhanced visibility into traffic flowing through Azure Firewall, enabling the optimization of your firewall configuration without impacting your application performance'
        Version       = '1.0.0'
        Category      = 'Network'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Network/firewallPolicies' {

        Require 'insights.isEnabled exists' {
            Field insights.isEnabled | Must -Exist
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Network/AzureFirewall_EnablePolicyAnalytics_Audit.json in Azure/azure-policy, under the MIT licence.