Bylaw

Gallery › Kubernetes › Azure Community Policy

Ensure the AKS cluster is not using the 'Free' tier SKU

Converted Policy Audit Deny Disabled Mode All Version 1.0.0

In the 'Free' tier, the Uptime SLA feature is not available. The Uptime SLA feature guarantees 99.95% availability of the Kubernetes API server endpoint for clusters using Availability Zones, and 99.9% of availability for clusters that aren't using Availability Zones.

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

Azure Policy JSONazurepolicy.json · 45 lines
{
  "name": "3aa87b5a-7823-4b57-8a43-42dd9df5aaa7",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "Ensure the AKS cluster is not using the 'Free' tier SKU",
    "description": "In the 'Free' tier, the Uptime SLA feature is not available. The Uptime SLA feature guarantees 99.95% availability of the Kubernetes API server endpoint for clusters using Availability Zones, and 99.9% of availability for clusters that aren't using Availability Zones.",
    "metadata": {
      "version": "1.0.0",
      "category": "Kubernetes"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Deny, Audit or Disabled the execution of the Policy"
        },
        "allowedValues": [
          "Deny",
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ContainerService/managedClusters"
          },
          {
            "field": "Microsoft.ContainerService/managedClusters/sku.tier",
            "equals": "Free"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylaw3aa87b5a-7823-4b57-8a43-42dd9df5aaa7.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '3aa87b5a-7823-4b57-8a43-42dd9df5aaa7' {

    Properties @{
        DisplayName = 'Ensure the AKS cluster is not using the ''Free'' tier SKU'
        Description = 'In the ''Free'' tier, the Uptime SLA feature is not available. The Uptime SLA feature guarantees 99.95% availability of the Kubernetes API server endpoint for clusters using Availability Zones, and 99.9% of availability for clusters that aren''t using Availability Zones.'
        Version     = '1.0.0'
        Category    = 'Kubernetes'
        Mode        = 'All'
    }

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

    Resource 'Microsoft.ContainerService/managedClusters' {

        Require 'sku.tier is not Free' {
            Field sku.tier | Must -Not -Be 'Free' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Kubernetes/ensure-the-aks-cluster-is-not-using-the-free-tier-sku/azurepolicy.json in Azure/Community-Policy, under the MIT licence.