Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: [Deprecated]: Monitor permissive network access in Azure Security Center

Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.0-deprecated Deprecated

Network Security Groups with too permissive rules will be monitored by Azure Security Center as recommendations

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

Azure Policy JSONASC_PermissiveNetworkAccess_Audit_Deprecated.json · 56 lines
{
  "properties": {
    "displayName": "[Deprecated]: [Deprecated]: Monitor permissive network access in Azure Security Center",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Network Security Groups with too permissive rules will be monitored by Azure Security Center as recommendations",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "Microsoft.Compute/virtualMachines",
          "Microsoft.ClassicCompute/virtualMachines"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/complianceResults",
          "name": "permissiveNetworkAccess",
          "existenceCondition": {
            "field": "Microsoft.Security/complianceResults/resourceStatus",
            "in": [
              "OffByPolicy",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed",
  "name": "44452482-524f-4bf4-b852-0bff7cc4a3ed"
}
Bylaw44452482-524f-4bf4-b852-0bff7cc4a3ed.bylaw.ps1 · 34 lines
# Converted from ASC_PermissiveNetworkAccess_Audit_Deprecated.json by ConvertTo-Bylaw.
Policy '44452482-524f-4bf4-b852-0bff7cc4a3ed' {

    Properties @{
        DisplayName   = '[Deprecated]: [Deprecated]: Monitor permissive network access in Azure Security Center'
        Description   = 'Network Security Groups with too permissive rules will be monitored by Azure Security Center as recommendations'
        Version       = '1.0.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

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

    Resource * {

        Require 'type is not one of 2 values' {
            Field type | Must -Not -BeIn @('Microsoft.Compute/virtualMachines', 'Microsoft.ClassicCompute/virtualMachines') -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Security/complianceResults' -Name 'permissiveNetworkAccess' -Effect (Param Effect) {
        Require 'resourceStatus is one of 2 values' {
            Field resourceStatus | Must -BeIn @('OffByPolicy', 'Healthy')
        }
    }
}

Source: built-in-policies/policyDefinitions/Security Center/ASC_PermissiveNetworkAccess_Audit_Deprecated.json in Azure/azure-policy, under the MIT licence.