{
    "properties": {
        "displayName": "Configure Azure Web PubSub Service to disable public network access",
        "description": "Disable public network access for your Azure Web PubSub resource so that it's not accessible over the public internet. This can reduce data leakage risks. Learn more at: https://aka.ms/awps/networkacls. ",
        "policyType": "BuiltIn",
        "mode": "Indexed",
        "metadata": {
            "version": "1.0.0",
            "category": "Web PubSub"
        },
        "parameters": {
            "effect": {
                "type": "String",
                "metadata": {
                    "displayName": "Effect",
                    "description": "Enable or disable the execution of the policy"
                },
                "allowedValues": [
                    "Modify",
                    "Disabled"
                ],
                "defaultValue": "Modify"
            }
        },
        "policyRule": {
            "if": {
                "allOf": [
                    {
                        "field": "type",
                        "equals": "Microsoft.SignalRService/webPubSub"
                    },
                    {
                        "field": "Microsoft.SignalRService/webPubSub/publicNetworkAccess",
                        "notEquals": "Disabled"
                    }
                ]
            },
            "then": {
                "effect": "[parameters('effect')]",
                "details": {
                    "conflictEffect": "Audit",
                    "roleDefinitionIds": [
                        "/providers/Microsoft.Authorization/roleDefinitions/8cf5e20a-e4b2-4e9d-b3a1-5ceb692c2761"
                    ],
                    "operations": [
                        {
                            "operation": "addOrReplace",
                            "field": "Microsoft.SignalRService/webPubSub/publicNetworkAccess",
                            "value": "Disabled"
                        }
                    ]
                }
            }
        }
    },
    "id": "/providers/Microsoft.Authorization/policyDefinitions/5b1213e4-06e4-4ccc-81de-4201f2f7131a",
    "name": "5b1213e4-06e4-4ccc-81de-4201f2f7131a"
}