Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: Access to App Services should be restricted

Converted Policy AuditIfNotExists Disabled Mode All Version 1.0.0-deprecated Deprecated

Azure security center has discovered that the networking configuration of some of your app services are overly permissive and allow inbound traffic from ranges that are too broad

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

Azure Policy JSONASC_PermissiveNetworkAccessToAppServices_Audit_deprecated.json · 53 lines
{
  "properties": {
    "displayName": "[Deprecated]: Access to App Services should be restricted",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "Azure security center has discovered that the networking configuration of some of your app services are overly permissive and allow inbound traffic from ranges that are too broad",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Web/sites"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/complianceResults",
          "name": "restrictAccessToAppServices",
          "existenceCondition": {
            "field": "Microsoft.Security/complianceResults/resourceStatus",
            "in": [
              "OffByPolicy",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1a833ff1-d297-4a0f-9944-888428f8e0ff",
  "name": "1a833ff1-d297-4a0f-9944-888428f8e0ff"
}
Bylaw1a833ff1-d297-4a0f-9944-888428f8e0ff.bylaw.ps1 · 29 lines
# Converted from ASC_PermissiveNetworkAccessToAppServices_Audit_deprecated.json by ConvertTo-Bylaw.
Policy '1a833ff1-d297-4a0f-9944-888428f8e0ff' {

    Properties @{
        DisplayName   = '[Deprecated]: Access to App Services should be restricted'
        Description   = 'Azure security center has discovered that the networking configuration of some of your app services are overly permissive and allow inbound traffic from ranges that are too broad'
        Version       = '1.0.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

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

    Resource 'Microsoft.Web/sites'

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

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