-
Notifications
You must be signed in to change notification settings - Fork 983
/
ENFORCE-GuardrailsCognitiveServicesPolicyAssignment.json
83 lines (83 loc) · 3.89 KB
/
ENFORCE-GuardrailsCognitiveServicesPolicyAssignment.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.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."
}
},
"enforcementMode": {
"type": "string",
"allowedValues": [
"Default",
"DoNotEnforce"
],
"defaultValue": "Default"
},
"nonComplianceMessagePlaceholder": {
"type": "string",
"defaultValue": "{enforcementMode}"
},
"assignmentIndex": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"policyDefinitions": {
"enforceGuardrailsCognitiveServices": "[concat('/providers/Microsoft.Management/managementGroups/', parameters('topLevelManagementGroupPrefix'), '/providers/Microsoft.Authorization/policySetDefinitions/Enforce-Guardrails-CognitiveServices')]"
},
"policyAssignmentNames": {
"enforceGuardrailsCognitiveServices": "[concat('Enforce-GR-CogServ', parameters('assignmentIndex'))]",
"description": "This initiative assignment enables additional ALZ guardrails for Cognitive Services.",
"displayName": "Enforce recommended guardrails for Cognitive Services"
},
"nonComplianceMessage": {
"message": "Recommended guardrails {enforcementMode} be enforced for Cognitive Services.",
"Default": "must",
"DoNotEnforce": "should"
},
"rbacContributor": "b24988ac-6180-42a0-ab88-20f7382dd24c",
"roleAssignmentNames": {
"deployRoles": "[guid(concat(parameters('toplevelManagementGroupPrefix'),variables('policyAssignmentNames').enforceGuardrailsCognitiveServices))]"
}
},
"resources": [
{
"type": "Microsoft.Authorization/policyAssignments",
"apiVersion": "2022-06-01",
"name": "[variables('policyAssignmentNames').enforceGuardrailsCognitiveServices]",
"location": "[deployment().location]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"description": "[variables('policyAssignmentNames').description]",
"displayName": "[variables('policyAssignmentNames').displayName]",
"policyDefinitionId": "[variables('policyDefinitions').enforceGuardrailsCognitiveServices]",
"enforcementMode": "[parameters('enforcementMode')]",
"nonComplianceMessages": [
{
"message": "[replace(variables('nonComplianceMessage').message, parameters('nonComplianceMessagePlaceholder'), variables('nonComplianceMessage')[parameters('enforcementMode')])]"
}
]
}
},
{
"type": "Microsoft.Authorization/roleAssignments",
"apiVersion": "2019-04-01-preview",
"name": "[variables('roleAssignmentNames').deployRoles]",
"dependsOn": [
"[resourceId('Microsoft.Authorization/policyAssignments', variables('policyAssignmentNames').enforceGuardrailsCognitiveServices)]"
],
"properties": {
"principalType": "ServicePrincipal",
"roleDefinitionId": "[concat('/providers/Microsoft.Authorization/roleDefinitions/', variables('rbacContributor'))]",
"principalId": "[toLower(reference(concat('/providers/Microsoft.Authorization/policyAssignments/', variables('policyAssignmentNames').enforceGuardrailsCognitiveServices), '2019-09-01', 'Full' ).identity.principalId)]"
}
}
],
"outputs": {}
}