Bylaw

Gallery › App Service › Azure built-in policies

[Deprecated]: App Service apps should have 'Client Certificates (Incoming client certificates)' enabled

Converted Policy Audit Disabled Mode Indexed Version 3.1.0-deprecated Deprecated

Client certificates allow for the app to request a certificate for incoming requests. Only clients that have a valid certificate will be able to reach the app. This policy has been replaced by a new policy with the same name because Http 2.0 doesn't support client certificates.

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

Azure Policy JSONWebapp_Audit_ClientCert.json · 63 lines
{
  "properties": {
    "displayName": "[Deprecated]: App Service apps should have 'Client Certificates (Incoming client certificates)' enabled",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Client certificates allow for the app to request a certificate for incoming requests. Only clients that have a valid certificate will be able to reach the app. This policy has been replaced by a new policy with the same name because Http 2.0 doesn't support client certificates.",
    "metadata": {
      "version": "3.1.0-deprecated",
      "category": "App Service",
      "deprecated": true
    },
    "version": "3.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/sites"
          },
          {
            "field": "kind",
            "notContains": "functionapp"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.Web/sites/clientCertEnabled",
                "exists": "false"
              },
              {
                "field": "Microsoft.Web/sites/clientCertEnabled",
                "equals": "false"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "3.1.0",
      "3.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/5bb220d9-2698-4ee4-8404-b9c30c9df609",
  "name": "5bb220d9-2698-4ee4-8404-b9c30c9df609"
}
Bylaw5bb220d9-2698-4ee4-8404-b9c30c9df609.bylaw.ps1 · 38 lines
# Converted from Webapp_Audit_ClientCert.json by ConvertTo-Bylaw.
Policy '5bb220d9-2698-4ee4-8404-b9c30c9df609' {

    Properties @{
        DisplayName   = '[Deprecated]: App Service apps should have ''Client Certificates (Incoming client certificates)'' enabled'
        Description   = 'Client certificates allow for the app to request a certificate for incoming requests. Only clients that have a valid certificate will be able to reach the app. This policy has been replaced by a new policy with the same name because Http 2.0 doesn''t support client certificates.'
        Version       = '3.1.0-deprecated'
        Category      = 'App Service'
        Deprecated    = $true
        PolicyVersion = '3.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Web/sites' {

        When {
            Field kind | Must -Not -ContainText 'functionapp'
        }

        Require 'clientCertEnabled exists' {
            Field clientCertEnabled | Must -Exist
        }

        Require 'clientCertEnabled is not false' {
            Field clientCertEnabled | Must -Not -Be 'false' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/App Service/Webapp_Audit_ClientCert.json in Azure/azure-policy, under the MIT licence.