Skip to content

Commit 046e49f

Browse files
Fix permissions Microsoft Defender for SQL policy assignment (#1564)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent d128e8b commit 046e49f

File tree

7 files changed

+47
-9
lines changed

7 files changed

+47
-9
lines changed

docs/wiki/ALZ-AMA-FAQ.md

+4
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ It's important to highlight that while MMA deprecation is in August 2024, this d
4141
- Sentinel: Is only deployed through ALZ, which is still achieved by deploying the Solution. We don't deploy additional configurations. Consult [AMA migration for Microsoft Sentinel](https://learn.microsoft.com/en-us/azure/sentinel/ama-migrate) for more information.
4242
- Change Tracking: Aside from the solution being deployed in Log Analytics, we deploy the new components like DCRs and policies to enable Change Tracking through AMA.
4343

44+
## Why is a Policy disbled in the "Configure SQL VMs and Arc-enabled SQL Servers to install Microsoft Defender for SQL and AMA with a user-defined LA workspace" initiative?
45+
46+
The Microsoft Defender for SQL are custom policies based on the built-in policies. These are made custom to add additional flexibility for resource naming and placement, as well as excluding certain resources from being deployed through Policy. The disabled policy didn’t add any additional value at this moment as the configurations it deploys are handled in the ARM template.
47+

docs/wiki/Whats-new.md

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ This article will be updated as and when changes are made to the above and anyth
3939

4040
Here's what's changed in Enterprise Scale/Azure Landing Zones:
4141

42+
### February 2024
43+
44+
#### Tooling
45+
46+
- Disabled a Policy in the Microsoft Defender for SQL initiative. As it is not required at this stage. See [ALZ AMA FAQ](./ALZ-AMA-FAQ) for more details.
47+
4248
### AMA Update for the Portal Accelerator
4349

4450
The Azure Monitor Agent (AMA) is the new way to collect and send data to Azure Monitor. The Log Analytics agent, or the Microsoft Monitoring Agent (MMA), will no longer be supported after August 2024. To adapt to this change, the ALZ Portal Accelerator has been updated to use AMA instead of MMA.

eslzArm/eslzArm.json

+3
Original file line numberDiff line numberDiff line change
@@ -3472,6 +3472,9 @@
34723472
},
34733473
"scope": {
34743474
"value": "[variables('scopes').lzsManagementGroup]"
3475+
},
3476+
"platformScope": {
3477+
"value": "[variables('scopes').platformManagementGroup]"
34753478
}
34763479
}
34773480
}

eslzArm/managementGroupTemplates/policyAssignments/DINE-MDFCDefenderSQLAMAPolicyAssignment.json

+27-2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@
103103
"displayName": "Scope",
104104
"description": "Scope of the policy assignment"
105105
}
106+
},
107+
"platformScope": {
108+
"type": "String",
109+
"metadata": {
110+
"displayName": "Platform Scope",
111+
"description": "Scope of the reader role assignment"
112+
},
113+
"defaultValue": "[parameters('scope')]"
106114
}
107115
},
108116
"variables": {
@@ -124,12 +132,14 @@
124132
"rbacMonitoringContributor": "749f88d5-cbae-40b8-bcfc-e573ddc772fa",
125133
"rbacManagedIdentityOperator": "f1a07417-d97a-45cb-824c-7a7467783830",
126134
"rbacContributor": "b24988ac-6180-42a0-ab88-20f7382dd24c",
135+
"rbacReader": "acdd72a7-3385-48ef-bd42-f606fba81ae7",
127136
"roleAssignmentNames": {
128137
"roleAssignmentNameLogAnalyticsContributor": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,parameters('scope')))]",
129138
"roleAssignmentNameVmContributor": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,'-2',parameters('scope')))]",
130139
"roleAssignmentNameMonitoringContributor": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,'-3',parameters('scope')))]",
131140
"roleAssignmentNameManagedIdentityOperator": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,'-4',parameters('scope')))]",
132-
"roleAssignmentNameContributor": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,'-5',parameters('scope')))]"
141+
"roleAssignmentNameContributor": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,'-5',parameters('scope')))]",
142+
"roleAssignmentNameReader": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').azureDefenderSQL,'-6',parameters('scope')))]"
133143
}
134144
},
135145
"resources": [
@@ -234,7 +244,7 @@
234244
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').azureDefenderSQL), '2019-09-01', 'Full' ).identity.principalId)]"
235245
}
236246
},
237-
{
247+
{
238248
"type": "Microsoft.Authorization/roleAssignments",
239249
"apiVersion": "2022-04-01",
240250
"name": "[variables('roleAssignmentNames').roleAssignmentNameContributor]",
@@ -246,6 +256,21 @@
246256
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
247257
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').azureDefenderSQL), '2019-09-01', 'Full' ).identity.principalId)]"
248258
}
259+
},
260+
{
261+
"condition": "[not(equals(parameters('platformScope'), parameters('scope')))]",
262+
"type": "Microsoft.Authorization/roleAssignments",
263+
"apiVersion": "2022-04-01",
264+
"name": "[variables('roleAssignmentNames').roleAssignmentNameReader]",
265+
"scope": "[parameters('platformScope')]",
266+
"dependsOn": [
267+
"[variables('policyAssignmentNames').azureDefenderSQL]"
268+
],
269+
"properties": {
270+
"principalType": "ServicePrincipal",
271+
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacReader'))]",
272+
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').azureDefenderSQL), '2019-09-01', 'Full' ).identity.principalId)]"
273+
}
249274
}
250275
],
251276
"outputs": {}

eslzArm/managementGroupTemplates/policyDefinitions/policies.json

+3-3
Large diffs are not rendered by default.

src/resources/Microsoft.Authorization/policyDefinitions/Deploy-MDFC-SQL-DefenderSQL-DCR.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"displayName": "Configure SQL Virtual Machines to automatically install Microsoft Defender for SQL and DCR with a user-defined LA workspace",
1010
"description": "Microsoft Defender for SQL collects events from the agent and uses them to provide security alerts and tailored hardening tasks (recommendations). Create a resource group and a Data Collection Rule in the same region as the user-defined Log Analytics workspace.",
1111
"metadata": {
12-
"version": "1.0.0",
12+
"version": "1.0.1",
1313
"category": "Security Center",
1414
"source": "https://github.com/Azure/Enterprise-Scale/",
1515
"alzCloudEnvironments": [
@@ -427,7 +427,7 @@
427427
},
428428
"parameters": {
429429
"resourceGroup": {
430-
"value": "[[parameters('dcrResourceGroup')]"
430+
"value": "[[resourceGroup().name]"
431431
},
432432
"location": {
433433
"value": "[[field('location')]"

src/resources/Microsoft.Authorization/policySetDefinitions/Deploy-MDFC-DefenderSQL-AMA.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"displayName": "Configure SQL VMs and Arc-enabled SQL Servers to install Microsoft Defender for SQL and AMA with a user-defined LA workspace",
99
"description": "Microsoft Defender for SQL collects events from the agents and uses them to provide security alerts and tailored hardening tasks (recommendations). Creates a resource group and a Data Collection Rule in the same region as the user-defined Log Analytics workspace.",
1010
"metadata": {
11-
"version": "1.0.0",
11+
"version": "1.0.1",
1212
"category": "Security Center",
1313
"source": "https://github.com/Azure/Enterprise-Scale/",
1414
"alzCloudEnvironments": [
@@ -208,7 +208,7 @@
208208
"policyDefinitionId": "/providers/Microsoft.Management/managementGroups/contoso/providers/Microsoft.Authorization/policyDefinitions/Deploy-MDFC-SQL-DefenderSQL-DCR",
209209
"parameters": {
210210
"effect": {
211-
"value": "[[parameters('effect')]"
211+
"value": "Disabled"
212212
},
213213
"userWorkspaceResourceId": {
214214
"value": "[[parameters('userWorkspaceResourceId')]"

0 commit comments

Comments
 (0)