Bylaw

Gallery › Mission › Azure built-in policies

App Service apps should use a SKU that supports private link.

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Use PLS supported SKU.

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

Azure Policy JSONAppRestrictPlanTiers_Audit.json · 103 lines
{
  "properties": {
    "displayName": "App Service apps should use a SKU that supports private link.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Use PLS supported SKU.",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.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.tier",
            "notIn": [
              "Basic",
              "Standard",
              "ElasticPremium",
              "Premium",
              "PremiumV2",
              "Premium0V3",
              "PremiumV3",
              "PremiumMV3",
              "Isolated",
              "IsolatedV2",
              "WorkflowStandard"
            ]
          },
          {
            "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",
              "I1",
              "I2",
              "I3",
              "I1V2",
              "I2V2",
              "I3V2",
              "I4V2",
              "I5V2",
              "I6V2",
              "WS1",
              "WS2",
              "WS3"
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/b3ba835a-f47b-4b3a-8d90-f08b006f2fd0",
  "name": "b3ba835a-f47b-4b3a-8d90-f08b006f2fd0"
}
Bylawb3ba835a-f47b-4b3a-8d90-f08b006f2fd0.bylaw.ps1 · 32 lines
# Converted from AppRestrictPlanTiers_Audit.json by ConvertTo-Bylaw.
Policy 'b3ba835a-f47b-4b3a-8d90-f08b006f2fd0' {

    Properties @{
        DisplayName   = 'App Service apps should use a SKU that supports private link.'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Use PLS supported SKU.'
        Version       = '1.0.0'
        Category      = 'Mission'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Web/serverFarms' {

        When {
            Field sku.tier | Must -Not -BeIn @('Basic', 'Standard', 'ElasticPremium', 'Premium', 'PremiumV2', 'Premium0V3', 'PremiumV3', 'PremiumMV3', 'Isolated', 'IsolatedV2', 'WorkflowStandard')
        }

        Require 'sku.name is one of 36 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', 'I1', 'I2', 'I3', 'I1V2', 'I2V2', 'I3V2', 'I4V2', 'I5V2', 'I6V2', 'WS1', 'WS2', 'WS3')
        }
    }

    Effect (Param Effect)
}

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