Skip to content

Commit a0362fe

Browse files
authored
Add policy to restrict manual changes to Virtual Machines (#43)
1 parent 9e5837c commit a0362fe

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

‎policyAssignments/dev/pa-d-vm.json‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,20 @@
127127
},
128128
"VM-010_NotificationWebhookUrl": {
129129
"value": ""
130+
},
131+
"VM-011_Effect": {
132+
"value": "Deny"
130133
}
131134
},
132135
"roleDefinitionIds": [
133136
"/providers/microsoft.authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
134137
],
135-
"nonComplianceMessages": []
138+
"nonComplianceMessages": [
139+
{
140+
"policyDefinitionReferenceId": "VM-011",
141+
"message": "PolicyID: VM-011 Violation in polset-vm Initiative - Manual changes to Virtual Machines are not allowed."
142+
}
143+
]
136144
},
137145
"definitionSourceManagementGroupId": "/providers/Microsoft.Management/managementGroups/CONTOSO-DEV",
138146
"managementGroupId": "CONTOSO-DEV"

‎policyAssignments/prod/pa-p-vm.json‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,20 @@
127127
},
128128
"VM-010_NotificationWebhookUrl": {
129129
"value": ""
130+
},
131+
"VM-011_Effect": {
132+
"value": "Deny"
130133
}
131134
},
132135
"roleDefinitionIds": [
133136
"/providers/microsoft.authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"
134137
],
135-
"nonComplianceMessages": []
138+
"nonComplianceMessages": [
139+
{
140+
"policyDefinitionReferenceId": "VM-011",
141+
"message": "PolicyID: VM-011 Violation in polset-vm Initiative - Manual changes to Virtual Machines are not allowed."
142+
}
143+
]
136144
},
137145
"definitionSourceManagementGroupId": "/providers/Microsoft.Management/managementGroups/CONTOSO",
138146
"managementGroupId": "CONTOSO"

‎policyInitiatives/polset-vm.json‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,26 @@
330330
"displayName": "VM-010: Webhook URL for VM Shutdown schedule notification",
331331
"description": "A notification will be posted to the specified webhook endpoint when the auto-shutdown is about to happen."
332332
}
333+
},
334+
"VM-011_Effect": {
335+
"type": "String",
336+
"metadata": {
337+
"displayName": "VM-011 Effect: Restrict Manual VM changes by Users",
338+
"description": "Enable or disable the execution of the policy"
339+
},
340+
"allowedValues": [
341+
"Audit",
342+
"Deny",
343+
"Disabled"
344+
],
345+
"defaultValue": "Deny"
333346
}
334347
},
335348
"policyDefinitionGroups": [
349+
{
350+
"name": "ISO27001-2013_A.12.1.2",
351+
"additionalMetadataId": "/providers/Microsoft.PolicyInsights/policyMetadata/ISO27001-2013_A.12.1.2"
352+
},
336353
{
337354
"name": "ISO27001-2013_A.12.2.1",
338355
"additionalMetadataId": "/providers/Microsoft.PolicyInsights/policyMetadata/ISO27001-2013_A.12.2.1"
@@ -538,6 +555,21 @@
538555
"groupNames": [
539556
"ISO27001-2013_A.12.6.1"
540557
]
558+
},
559+
{
560+
"policyDefinitionReferenceId": "VM-011",
561+
"policyDefinitionId": "{policyLocationResourceId}/providers/Microsoft.Authorization/policyDefinitions/pol-restrict-user-arm-api-requests",
562+
"parameters": {
563+
"effect": {
564+
"value": "[parameters('VM-011_Effect')]"
565+
},
566+
"resourceTypePrefix": {
567+
"value": "Microsoft.Compute/virtualMachines"
568+
}
569+
},
570+
"groupNames": [
571+
"ISO27001-2013_A.12.1.2"
572+
]
541573
}
542574
]
543575
}

0 commit comments

Comments
 (0)