{
    "properties": {
        "displayName": "Modify Azure SignalR Service resources to disable public network access",
        "description": "To improve the security of Azure SignalR Service resource, ensure that it isn't exposed to the public internet and can only be accessed from a private endpoint. Disable the public network access property as described in https://aka.ms/asrs/networkacls. This option disables access from any public address space outside the Azure IP range, and denies all logins that match IP or virtual network-based firewall rules. This reduces data leakage risks.",
        "policyType": "BuiltIn",
        "mode": "Indexed",
        "metadata": {
            "version": "1.0.0",
            "category": "SignalR"
        },
        "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/SignalR"
                    },
                    {
                        "anyOf": [
                            {
                                "field": "Microsoft.SignalRService/SignalR/networkACLs.defaultAction",
                                "equals": "Allow"
                            },
                            {
                                "field": "Microsoft.SignalRService/SignalR/networkACLs.publicNetwork.allow",
                                "exists": false
                            },
                            {
                                "count": {
                                    "field": "Microsoft.SignalRService/SignalR/networkACLs.publicNetwork.allow[*]"
                                },
                                "greater": 0
                            }
                        ]
                    }
                ]
            },
            "then": {
                "effect": "[parameters('effect')]",
                "details": {
                    "conflictEffect": "Audit",
                    "roleDefinitionIds": [
                        "/providers/Microsoft.Authorization/roleDefinitions/8cf5e20a-e4b2-4e9d-b3a1-5ceb692c2761"
                    ],
                    "operations": [
                        {
                            "operation": "addOrReplace",
                            "field": "Microsoft.SignalRService/SignalR/networkACLs.defaultAction",
                            "value": "Deny"
                        },
                        {
                            "operation": "addOrReplace",
                            "field": "Microsoft.SignalRService/SignalR/networkACLs.publicNetwork.allow",
                            "value": []
                        }
                    ]
                }
            }
        }
    },
    "id": "/providers/Microsoft.Authorization/policyDefinitions/62a3ae95-8169-403e-a2d2-b82141448092",
    "name": "62a3ae95-8169-403e-a2d2-b82141448092"
}