output/20260723_081532/govviz/ALZ_20260723_081601/Enterprise-Scale/eslzArm/managementGroupTemplates/policyAssignments/MODIFY-DDoSPolicyAssignment.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "topLevelManagementGroupPrefix": {
            "type": "string",
            "metadata": {
                "description": "Provide the ESLZ company prefix to the intermediate root management group containing the policy definitions."
            }
        },
        "ddosPlanResourceId": {
            "type": "string",
            "metadata": {
                "description": "Provide the resourceId to the DDoS Network Protection in your connectivity subscription."
            }
        },
        "enforcementMode": {
            "type": "string",
            "allowedValues": [
                "Default",
                "DoNotEnforce"
            ],
            "defaultValue": "Default"
        },
        "nonComplianceMessagePlaceholder": {
            "type": "string",
            "defaultValue": "{enforcementMode}"
        }
    },
    "variables": {
        "policyDefinitions": {
             "deployDoS": "/providers/Microsoft.Authorization/policyDefinitions/94de2ad3-e0c1-4caf-ad78-5d47bbc83d3d",
            "policyVersion": "1.*.*"
        },
        "policyAssignmentNames": {
            "deployDdoS": "Enable-DDoS-VNET",
            "description": "Protect your virtual networks against volumetric and protocol attacks with Azure DDoS Network Protection. For more information, visit https://aka.ms/ddosprotectiondocs.",
            "displayName": "Virtual networks should be protected by Azure DDoS Network Protection"
        },
        "nonComplianceMessage": {
            "message": "Virtual networks {enforcementMode} be protected by Azure DDoS Network Protection.",
            "Default": "must",
            "DoNotEnforce": "should"
        },
        "rbacNetworkContributor": "4d97b98b-1d4f-4787-a291-c67834d212e7",
        "roleAssignmentNames": {
            "deployDdoS": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').deployDdoS))]"
         }
    },
    "resources": [
        {
            "type": "Microsoft.Authorization/policyAssignments",
            "apiVersion": "2024-04-01",
            "name": "[variables('policyAssignmentNames').deployDdoS]",
            "location": "[deployment().location]",
            "identity": {
                "type": "SystemAssigned"
            },
            "properties": {
                "description": "[variables('policyAssignmentNames').description]",
                "displayName": "[variables('policyAssignmentNames').displayName]",
                "policyDefinitionId": "[variables('policyDefinitions').deployDoS]",
                "definitionVersion": "[variables('policyDefinitions').policyVersion]",
                "enforcementMode": "[parameters('enforcementMode')]",
                "parameters": {
                    "ddosPlan": {
                        "value": "[parameters('ddosPlanResourceId')]"
                    },
                    "effect": {
                        "value": "Modify"
                    }
                }
            }
        },
        {
            "type": "Microsoft.Authorization/roleAssignments",
            "apiVersion": "2019-04-01-preview",
            "name": "[variables('roleAssignmentNames').deployDdoS]",
            "dependsOn": [
                "[resourceId('Microsoft.Authorization/policyAssignments', variables('policyAssignmentNames').deployDdoS)]"
            ],
            "properties": {
                "principalType": "ServicePrincipal",
                "roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacNetworkContributor'))]",
                "principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').deployDdoS), '2019-09-01', 'Full' ).identity.principalId)]"
            }
        }
           ],
    "outputs": {}
}