-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
FIC_LimitToAzureKubernetesIssuer.json
121 lines (121 loc) · 5.08 KB
/
FIC_LimitToAzureKubernetesIssuer.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
118
119
120
121
{
"properties": {
"displayName": "[Preview]: [Preview]: Managed Identity Federated Credentials from Azure Kubernetes should be from trusted sources",
"mode": "All",
"policyType": "BuiltIn",
"description": "This policy limits federeation with Azure Kubernetes clusters to only clusters from approved tenants, approved regions, and a specific exception list of additional clusters.",
"metadata": {
"version": "1.0.0-preview",
"category": "Managed Identity",
"preview": true
},
"version": "1.0.0-preview",
"parameters": {
"allowedTenants": {
"type": "Array",
"metadata": {
"displayName": "Allowed tenants",
"description": "The list of allowed Azure AD tenant ID's of AKS OIDC issuers. Empty to allow all tenants."
}
},
"allowedLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed locations",
"description": "The list of allowed locations for AKS OIDC issuers. Empty to allow any location.",
"strongType": "location"
},
"defaultValue": []
},
"allowedClusterExceptions": {
"type": "Array",
"metadata": {
"displayName": "Allowed Exception Clusters",
"description": "The list of specific cluster ids that will be exceptions to the location and tenant rules."
},
"defaultValue": []
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy."
},
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials"
},
{
"allOf": [
{
"value": "[if(greaterOrEquals(length(split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')),3),split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')[2],'')]",
"like": "*.oic.prod-aks.azure.com"
},
{
"not": {
"anyOf": [
{
"allOf": [
{
"anyOf": [
{
"count": {
"value": "[parameters('allowedLocations')]"
},
"equals": 0
},
{
"value": "[if(greaterOrEquals(length(split(if(greaterOrEquals(length(split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')),3),split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')[2],''), '.')),1),split(if(greaterOrEquals(length(split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')),3),split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')[2],''), '.')[0],'')]",
"in": "[parameters('allowedLocations')]"
}
]
},
{
"anyOf": [
{
"count": {
"value": "[parameters('allowedTenants')]"
},
"equals": 0
},
{
"value": "[if(greaterOrEquals(length(split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')),4),split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')[3],'')]",
"in": "[parameters('allowedTenants')]"
}
]
}
]
},
{
"value": "[if(greaterOrEquals(length(split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')),5),split(field('Microsoft.ManagedIdentity/userAssignedIdentities/federatedIdentityCredentials/issuer'),'/')[4],'')]",
"in": "[parameters('allowedClusterExceptions')]"
}
]
}
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ae62c456-33de-4dc8-b100-7ce9028a7d99",
"name": "ae62c456-33de-4dc8-b100-7ce9028a7d99"
}