/
ArcPolicyExtension_DINE.json
117 lines (117 loc) · 3.98 KB
/
ArcPolicyExtension_DINE.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
"properties": {
"displayName": "Configure Azure Arc enabled Kubernetes clusters to install the Azure Policy extension",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Deploy Azure Policy's extension for Azure Arc to provide at-scale enforcements and safeguard your Arc enabled Kubernetes clusters in a centralized, consistent manner. Learn more at https://aka.ms/akspolicydoc.",
"metadata": {
"version": "1.1.0",
"category": "Kubernetes"
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "DeployIfNotExists",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Kubernetes/connectedClusters"
},
{
"field": "Microsoft.Kubernetes/connectedClusters/distribution",
"notEquals": "aks"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.KubernetesConfiguration/extensions",
"evaluationDelay": "AfterProvisioning",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.KubernetesConfiguration/extensions/extensionType",
"equals": "microsoft.policyinsights"
},
{
"field": "Microsoft.KubernetesConfiguration/extensions/provisioningState",
"equals": "Succeeded"
}
]
},
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/85cb6faf-e071-4c9b-8136-154b5a04f717"
],
"deployment": {
"properties": {
"mode": "incremental",
"parameters": {
"clusterRegion": {
"value": "[field('location')]"
},
"clusterResourceId": {
"value": "[field('id')]"
}
},
"template": {
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterRegion": {
"type": "string"
},
"clusterResourceId": {
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.KubernetesConfiguration/extensions",
"apiVersion": "2021-09-01",
"name": "azurepolicy",
"location": "[parameters('clusterRegion')]",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"extensionType": "microsoft.policyinsights",
"configurationSettings": {},
"configurationProtectedSettings": {},
"autoUpgradeMinorVersion": true,
"releaseTrain": "Stable",
"scope": {
"Cluster": {
"releaseNamespace": "kube-system"
}
}
},
"scope": "[concat('Microsoft.Kubernetes/connectedClusters/', split(parameters('clusterResourceId'),'/')[8])]"
}
]
}
}
}
}
}
},
"versions": [
"1.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0adc5395-9169-4b9b-8687-af838d69410a",
"name": "0adc5395-9169-4b9b-8687-af838d69410a"
}