Bylaw

Gallery › Network › Azure built-in policies

Azure Application Gateway for Containers must have security policies

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0

Ensures Application Gateway for Containers has at least one security policy configured

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

Azure Policy JSONAzureAppGwForContainersMustHaveSecurityPolicies_AINE.json · 44 lines
{
  "properties": {
    "displayName": "Azure Application Gateway for Containers must have security policies",
    "policyType": "BuiltIn",
    "version": "1.0.0",
    "mode": "Indexed",
    "description": "Ensures Application Gateway for Containers has at least one security policy configured",
    "metadata": {
      "category": "Network",
      "version": "1.0.0"
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the policy"
        },
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.ServiceNetworking/trafficControllers"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies"
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/c3a8e4bd-b215-4c99-bd53-92f8d7ea65f7",
  "name": "c3a8e4bd-b215-4c99-bd53-92f8d7ea65f7"
}
Bylawc3a8e4bd-b215-4c99-bd53-92f8d7ea65f7.bylaw.ps1 · 23 lines
# Converted from AzureAppGwForContainersMustHaveSecurityPolicies_AINE.json by ConvertTo-Bylaw.
Policy 'c3a8e4bd-b215-4c99-bd53-92f8d7ea65f7' {

    Properties @{
        DisplayName   = 'Azure Application Gateway for Containers must have security policies'
        Description   = 'Ensures Application Gateway for Containers has at least one security policy configured'
        Category      = 'Network'
        Version       = '1.0.0'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.ServiceNetworking/trafficControllers'

    AuditIfNotExists 'Microsoft.ServiceNetworking/trafficControllers/securityPolicies' -Effect (Param Effect)
}

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