Bylaw

Gallery › API Management › Azure built-in policies

Azure API Management platform version should be stv2

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Azure API Management stv1 compute platform version will be retired effective 31 August 2024, and these instances should be migrated to stv2 compute platform for continued support. Learn more at https://learn.microsoft.com/azure/api-management/breaking-changes/stv1-platform-retirement-august-2024

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

Azure Policy JSONPlatformVersion_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "Azure API Management platform version should be stv2",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Azure API Management stv1 compute platform version will be retired effective 31 August 2024, and these instances should be migrated to stv2 compute platform for continued support. Learn more at https://learn.microsoft.com/azure/api-management/breaking-changes/stv1-platform-retirement-august-2024",
    "metadata": {
      "version": "1.0.0",
      "category": "API Management"
    },
    "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.ApiManagement/service"
          },
          {
            "field": "Microsoft.ApiManagement/service/platformVersion",
            "equals": "stv1"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1dc2fc00-2245-4143-99f4-874c937f13ef",
  "name": "1dc2fc00-2245-4143-99f4-874c937f13ef"
}
Bylaw1dc2fc00-2245-4143-99f4-874c937f13ef.bylaw.ps1 · 28 lines
# Converted from PlatformVersion_AuditDeny.json by ConvertTo-Bylaw.
Policy '1dc2fc00-2245-4143-99f4-874c937f13ef' {

    Properties @{
        DisplayName   = 'Azure API Management platform version should be stv2'
        Description   = 'Azure API Management stv1 compute platform version will be retired effective 31 August 2024, and these instances should be migrated to stv2 compute platform for continued support. Learn more at https://learn.microsoft.com/azure/api-management/breaking-changes/stv1-platform-retirement-august-2024'
        Version       = '1.0.0'
        Category      = 'API Management'
        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.ApiManagement/service' {

        Require 'platformVersion is not stv1' {
            Field platformVersion | Must -Not -Be 'stv1' -IfPresent
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/API Management/PlatformVersion_AuditDeny.json in Azure/azure-policy, under the MIT licence.