{
  "properties": {
    "displayName": "Enforce Cost-Optimised VM Sizes",
    "description": "This policy ensures that only cost-effective B-Series VM sizes can be deployed within the scope, preventing unauthorised expenditure on high-performance SKUs.",
    "mode": "Indexed",
    "metadata": {
      "category": "Governance",
      "version": "1.0.0"
    },
    "parameters": {
      "listOfAllowedSKUs": {
        "type": "Array",
        "metadata": {
          "description": "The list of allowed B-Series VM sizes (SKUs).",
          "displayName": "Allowed SKUs"
        },
        "defaultValue": [
          "Standard_B1s",
          "Standard_B1ms"
        ]
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Compute/virtualMachines"
          },
          {
            "not": {
              "field": "Microsoft.Compute/virtualMachines/sku.name",
              "in": "[parameters('listOfAllowedSKUs')]"
            }
          }
        ]
      },
      "then": {
        "effect": "deny"
      }
    }
  }
}
