Bylaw

Gallery › App Service › Azure built-in policies

App Service apps should use a SKU that supports private link

Converted Policy Audit Deny Disabled Mode Indexed Version 4.3.0

With supported SKUs, Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to apps, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/private-link.

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

Azure Policy JSONDisablePrivateEndpoint_Deny.json · 101 lines
{
  "properties": {
    "displayName": "App Service apps should use a SKU that supports private link",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "With supported SKUs, Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to apps, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/private-link.",
    "metadata": {
      "version": "4.3.0",
      "category": "App Service"
    },
    "version": "4.3.0",
    "parameters": {
      "effect": {
        "type": "string",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/serverFarms"
          },
          {
            "field": "Microsoft.Web/serverFarms/sku.name",
            "notIn": [
              "B1",
              "B2",
              "B3",
              "S1",
              "S2",
              "S3",
              "EP1",
              "EP2",
              "EP3",
              "P1",
              "P2",
              "P3",
              "P1V2",
              "P2V2",
              "P3V2",
              "P0V3",
              "P1V3",
              "P2V3",
              "P3V3",
              "P1MV3",
              "P2MV3",
              "P3MV3",
              "P4MV3",
              "P5MV3",
              "P0V4",
              "P1V4",
              "P2V4",
              "P3V4",
              "P1MV4",
              "P2MV4",
              "P3MV4",
              "P4MV4",
              "P5MV4",
              "I1V2",
              "I2V2",
              "I3V2",
              "I4V2",
              "I5V2",
              "I6V2",
              "I1MV2",
              "I2MV2",
              "I3MV2",
              "I4MV2",
              "I5MV2",
              "WS1",
              "WS2",
              "WS3",
              "FC1"
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "4.3.0",
      "4.2.0",
      "4.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/546fe8d2-368d-4029-a418-6af48a7f61e5",
  "name": "546fe8d2-368d-4029-a418-6af48a7f61e5"
}
Bylaw546fe8d2-368d-4029-a418-6af48a7f61e5.bylaw.ps1 · 29 lines
# Converted from DisablePrivateEndpoint_Deny.json by ConvertTo-Bylaw.
Policy '546fe8d2-368d-4029-a418-6af48a7f61e5' {

    Properties @{
        DisplayName   = 'App Service apps should use a SKU that supports private link'
        Description   = 'With supported SKUs, Azure Private Link lets you connect your virtual network to Azure services without a public IP address at the source or destination. The Private Link platform handles the connectivity between the consumer and services over the Azure backbone network. By mapping private endpoints to apps, you can reduce data leakage risks. Learn more about private links at: https://aka.ms/private-link.'
        Version       = '4.3.0'
        Category      = 'App Service'
        PolicyVersion = '4.3.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Web/serverFarms' {

        Require 'sku.name is one of 48 values' {
            Field sku.name | Must -BeIn @('B1', 'B2', 'B3', 'S1', 'S2', 'S3', 'EP1', 'EP2', 'EP3', 'P1', 'P2', 'P3', 'P1V2', 'P2V2', 'P3V2', 'P0V3', 'P1V3', 'P2V3', 'P3V3', 'P1MV3', 'P2MV3', 'P3MV3', 'P4MV3', 'P5MV3', 'P0V4', 'P1V4', 'P2V4', 'P3V4', 'P1MV4', 'P2MV4', 'P3MV4', 'P4MV4', 'P5MV4', 'I1V2', 'I2V2', 'I3V2', 'I4V2', 'I5V2', 'I6V2', 'I1MV2', 'I2MV2', 'I3MV2', 'I4MV2', 'I5MV2', 'WS1', 'WS2', 'WS3', 'FC1')
        }
    }

    Effect (Param Effect)
}

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