{
    "properties": {
        "displayName": "API Management services should use a virtual network",
        "policyType": "BuiltIn",
        "mode": "Indexed",
        "description": "Azure Virtual Network deployment provides enhanced security, isolation and allows you to place your API Management service in a non-internet routable network that you control access to. These networks can then be connected to your on-premises networks using various VPN technologies, which enables access to your backend services within the network and/or on-premises. The developer portal and API gateway, can be configured to be accessible either from the Internet or only within the virtual network.",
        "metadata": {
            "version": "1.0.1",
            "category": "API Management"
        },
        "parameters": {
            "effect": {
                "type": "String",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Enable or disable the execution of the policy"
                },
                "allowedValues": [
                    "Audit",
                    "Disabled"
                ],
                "defaultValue": "Audit"
            },
            "evaluatedSkuNames": {
                "type": "Array",
                "metadata": {
                    "displayName": "API Management SKU Names",
                    "description": "List of API Management SKUs against which this policy will be evaluated."
                },
                "allowedValues": [
                    "Developer",
                    "Basic",
                    "Standard",
                    "Premium",
                    "Consumption"
                ],
                "defaultValue": [
                    "Developer",
                    "Premium"
                ]
            }
        },
        "policyRule": {
            "if": {
                "allOf": [
                    {
                        "field": "type",
                        "equals": "Microsoft.ApiManagement/service"
                    },
                    {
                        "field": "Microsoft.ApiManagement/service/sku.name",
                        "in": "[parameters('evaluatedSkuNames')]"
                    },
                    {
                        "anyOf": [
                            {
                                "field": "Microsoft.ApiManagement/service/virtualNetworkType",
                                "exists": "false"
                            },
                            {
                                "field": "Microsoft.ApiManagement/service/virtualNetworkType",
                                "equals": "None"
                            }
                        ]
                    }
                ]
            },
            "then": {
                "effect": "[parameters('effect')]"
            }
        }
    },
    "id": "/providers/Microsoft.Authorization/policyDefinitions/ef619a2c-cc4d-4d03-b2ba-8c94a834d85b",
    "name": "ef619a2c-cc4d-4d03-b2ba-8c94a834d85b"
}