|
| 1 | +# Module: ALZ Specific Policy Assignments |
| 2 | + |
| 3 | +This module deploys the default Azure Landing Zone Azure Policy Assignments to the Management Group Hierarchy and also assigns the relevant RBAC for the system-assigned Managed Identities created for policies that require them (e.g DeployIfNotExist & Modify effect policies). |
| 4 | + |
| 5 | +Exclusion of specific ALZ default policies which does not fit your organization is supported, check out [Exclude specific policy assignments from ALZ Default Policy Assignments](https://github.com/Azure/ALZ-Bicep/wiki/AssigningPolicies#what-if-i-want-to-exclude-specific-policy-assignments-from-alz-default-policy-assignments) |
| 6 | + |
| 7 | +If you wish to add your own additional Azure Policy Assignments please review [How Does ALZ-Bicep Implement Azure Policies?](https://github.com/Azure/ALZ-Bicep/wiki/PolicyDeepDive) and more specifically [Adding Custom Azure Policy Definitions](https://github.com/Azure/ALZ-Bicep/wiki/AddingPolicyDefs) |
| 8 | + |
| 9 | +## Parameters |
| 10 | + |
| 11 | +- [Parameters for Azure Commercial Cloud](generateddocs/alzDefaultPolicyAssignments.bicep.md) |
| 12 | +- [Parameters for Azure China Cloud](generateddocs/mc-alzDefaultPolicyAssignments.bicep.md) |
| 13 | + |
| 14 | +## Outputs |
| 15 | + |
| 16 | +The module does not generate any outputs. |
| 17 | + |
| 18 | +## Deployment |
| 19 | + |
| 20 | +> For the examples below we assume you have downloaded or cloned the Git repo as-is and are in the root of the repository as your selected directory in your terminal of choice. |
| 21 | +<!-- markdownlint-disable --> |
| 22 | +> **Important:** If you decide to not use a DDoS Network Protection plan in your environment and therefore leave the parameter `parDdosProtectionPlanId` as an empty string (`''`) then the policy Enable-DDoS-VNET will not be assigned at connectivity or landing zone Management Groups to avoid VNET deployment issues. For deployment in Azure China, leave the parameter `parDdosProtectionPlanId` as an empty string (`''`) because the DDoS Protection feature is not available in Azure China. |
| 23 | +> |
| 24 | +> However, if you later do decide to deploy an DDoS Network Protection Plan, you will need to remember to come back and update the parameter `parDdosProtectionPlanId` with the resource ID of the DDoS Network Protection Plan to ensure the policy is applied to the relevant Management Groups. You can then use a policy [remediation task](https://docs.microsoft.com/azure/governance/policy/how-to/remediate-resources) to bring all non-compliant VNETs back into compliance, once a [compliance scan](https://docs.microsoft.com/azure/governance/policy/how-to/get-compliance-data#evaluation-triggers) has taken place. |
| 25 | +<!-- markdownlint-restore --> |
| 26 | +
|
| 27 | +### Azure CLI |
| 28 | +```bash |
| 29 | +# For Azure global regions |
| 30 | + |
| 31 | +dateYMD=$(date +%Y%m%dT%H%M%S%NZ) |
| 32 | +NAME="alz-alzPolicyAssignmentDefaults-${dateYMD}" |
| 33 | +LOCATION="eastus" |
| 34 | +MGID="alz" |
| 35 | +TEMPLATEFILE="infra-as-code/bicep/modules/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep" |
| 36 | +PARAMETERS="@infra-as-code/bicep/modules/policy/assignments/alzDefaults/parameters/alzDefaultPolicyAssignments.parameters.all.json" |
| 37 | + |
| 38 | +az deployment mg create --name ${NAME:0:63} --location $LOCATION --management-group-id $MGID --template-file $TEMPLATEFILE --parameters $PARAMETERS |
| 39 | +``` |
| 40 | +OR |
| 41 | +```bash |
| 42 | +# For Azure China regions |
| 43 | + |
| 44 | +dateYMD=$(date +%Y%m%dT%H%M%S%NZ) |
| 45 | +NAME="alz-alzPolicyAssignmentDefaults-${dateYMD}" |
| 46 | +LOCATION="chinaeast2" |
| 47 | +MGID="alz" |
| 48 | +TEMPLATEFILE="infra-as-code/bicep/modules/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep" |
| 49 | +PARAMETERS="@infra-as-code/bicep/modules/policy/assignments/alzDefaults/parameters/alzDefaultPolicyAssignments.parameters.all.json" |
| 50 | + |
| 51 | +az deployment mg create --name ${NAME:0:63} --location $LOCATION --management-group-id $MGID --template-file $TEMPLATEFILE --parameters $PARAMETERS |
| 52 | +``` |
| 53 | + |
| 54 | +### PowerShell |
| 55 | + |
| 56 | +```powershell |
| 57 | +# For Azure global regions |
| 58 | +
|
| 59 | +$inputObject = @{ |
| 60 | + DeploymentName = -join ('alz-alzPolicyAssignmentDefaultsDeployment-{0}' -f (Get-Date -Format 'yyyyMMddTHHMMssffffZ'))[0..63] |
| 61 | + Location = 'eastus' |
| 62 | + ManagementGroupId = 'alz' |
| 63 | + TemplateFile = "infra-as-code/bicep/modules/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep" |
| 64 | + TemplateParameterFile = 'infra-as-code/bicep/modules/policy/assignments/alzDefaults/parameters/alzDefaultPolicyAssignments.parameters.all.json' |
| 65 | +} |
| 66 | +
|
| 67 | +New-AzManagementGroupDeployment @inputObject |
| 68 | +``` |
| 69 | +OR |
| 70 | +```powershell |
| 71 | +# For Azure China regions |
| 72 | +
|
| 73 | +$inputObject = @{ |
| 74 | + DeploymentName = -join ('alzPolicyAssignmentDefaultsDeployment-{0}' -f (Get-Date -Format 'yyyyMMddTHHMMssffffZ'))[0..63] |
| 75 | + Location = 'chinaeast2' |
| 76 | + ManagementGroupId = 'alz' |
| 77 | + TemplateFile = "infra-as-code/bicep/modules/policy/assignments/alzDefaults/alzDefaultPolicyAssignments.bicep" |
| 78 | + TemplateParameterFile = 'infra-as-code/bicep/modules/policy/assignments/alzDefaults/parameters/mc-alzDefaultPolicyAssignments.parameters.all.json' |
| 79 | +} |
| 80 | +
|
| 81 | +New-AzManagementGroupDeployment @inputObject |
| 82 | +``` |
| 83 | + |
| 84 | +## Bicep Visualizer |
| 85 | + |
| 86 | + |
0 commit comments