Skip to content

Commit 0d9a3ea

Browse files
authored
Updated AKS version to 1.27.9 Azure#2771 Azure#1731 Azure#2570 (Azure#2772)
1 parent 71b205d commit 0d9a3ea

14 files changed

+235
-163
lines changed

data/policy-ignore.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,19 @@
4444
},
4545
{
4646
"policyDefinitionIds": [
47-
"/providers/Microsoft.Authorization/policyDefinitions/0a15ec92-a229-4763-bb14-0ea34a568f8d"
47+
"/providers/Microsoft.Authorization/policyDefinitions/0a15ec92-a229-4763-bb14-0ea34a568f8d",
48+
"/providers/Microsoft.Authorization/policyDefinitions/a8eff44f-8c92-45c3-a3fb-9880802d67a7"
4849
],
4950
"reason": "Duplicate",
5051
"value": "Azure.AKS.AzurePolicyAddOn"
5152
},
53+
{
54+
"policyDefinitionIds": [
55+
"/providers/Microsoft.Authorization/policyDefinitions/5c345cdf-2049-47e0-b8fe-b0e96bc2df35"
56+
],
57+
"reason": "Duplicate",
58+
"value": "Azure.AKS.AutoUpgrade"
59+
},
5260
{
5361
"policyDefinitionIds": [
5462
"/providers/Microsoft.Authorization/policyDefinitions/4fa4b6c0-31ca-4c0d-b10d-24b96f62a751"

docs/CHANGELOG-v1.md

+4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ What's changed since pre-release v1.35.0-B0030:
4242
[#2768](https://github.com/Azure/PSRule.Rules.Azure/issues/2768)
4343
- Fixed `Azure.AppService.PHPVersion` check fails when phpVersion is null.
4444
- Bumped rule set to `2024_03`.
45+
- Updated `Azure.AKS.Version` to use `1.27.9` as the minimum version by @BernieWhite.
46+
[#2771](https://github.com/Azure/PSRule.Rules.Azure/issues/2771)
4547
- General improvements:
4648
- Quality updates to rule documentation by @BernieWhite.
4749
[#2570](https://github.com/Azure/PSRule.Rules.Azure/issues/2570)
50+
- Additional policies added to default ignore list by @BernieWhite.
51+
[#1731](https://github.com/Azure/PSRule.Rules.Azure/issues/1731)
4852
- Bug fixes:
4953
- Fixed failed to expand JObject value with invalid key by @BernieWhite.
5054
[#2751](https://github.com/Azure/PSRule.Rules.Azure/issues/2751)

docs/en/rules/Azure.AKS.AutoUpgrade.md

+17-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
reviewed: 2021/12/10
2+
reviewed: 2024-03-25
33
severity: Important
44
pillar: Operational Excellence
5-
category: Automation
5+
category: OE:09 Task automation
66
resource: Azure Kubernetes Service
77
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.AKS.AutoUpgrade/
88
---
@@ -22,13 +22,13 @@ To configure auto-upgrades select a release channel instead of the default `none
2222
The following release channels are available:
2323

2424
- `none` - Disables auto-upgrades.
25-
The default setting.
25+
The default setting.
2626
- `patch` - Automatically upgrade to the latest supported patch version of the current minor version.
2727
- `stable` - Automatically upgrade to the latest supported patch release of the recommended minor version.
28-
This is N-1 of the current AKS non-preview minor version.
28+
This is N-1 of the current AKS non-preview minor version.
2929
- `rapid` - Automatically upgrade to the latest supported patch of the latest support minor version.
3030
- `node-image` - Automatically upgrade to the latest node image version.
31-
Normally upgraded weekly.
31+
Normally upgraded weekly.
3232

3333
## RECOMMENDATION
3434

@@ -189,10 +189,17 @@ resource cluster 'Microsoft.ContainerService/managedClusters@2021-07-01' = {
189189
az aks update -n '<name>' -g '<resource_group>' --auto-upgrade-channel 'stable'
190190
```
191191

192+
### Configure with Azure Policy
193+
194+
To address this issue at runtime use the following policies:
195+
196+
- [Azure Kubernetes Service Clusters should enable cluster auto-upgrade](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Kubernetes/AKS_Autoupgrade_Cluster_Audit.json)
197+
`/providers/Microsoft.Authorization/policyDefinitions/5c345cdf-2049-47e0-b8fe-b0e96bc2df35`
198+
192199
## LINKS
193200

194-
- [Automation overview](https://learn.microsoft.com/azure/architecture/framework/devops/automation-overview)
195-
- [Supported Kubernetes versions in Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions)
196-
- [Support policies for Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/support-policies)
197-
- [Set auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel)
198-
- [Azure deployment reference](https://docs.microsoft.com/azure/templates/microsoft.containerservice/managedclusters#ManagedClusterAutoUpgradeProfile)
201+
- [OE:09 Task automation](https://learn.microsoft.com/azure/well-architected/operational-excellence/automate-tasks)
202+
- [Supported Kubernetes versions in Azure Kubernetes Service](https://learn.microsoft.com/azure/aks/supported-kubernetes-versions)
203+
- [Support policies for Azure Kubernetes Service](https://learn.microsoft.com/azure/aks/support-policies)
204+
- [Automatically upgrade an Azure Kubernetes Service (AKS) cluster](https://learn.microsoft.com/azure/aks/auto-upgrade-cluster)
205+
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.containerservice/managedclusters)
+138-86
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2+
reviewed: 2024-03-25
23
severity: Important
34
pillar: Security
4-
category: Optimize
5+
category: SE:08 Hardening resources
56
resource: Azure Kubernetes Service
67
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.AKS.AzurePolicyAddOn/
78
---
@@ -41,72 +42,93 @@ For example:
4142

4243
```json
4344
{
44-
"type": "Microsoft.ContainerService/managedClusters",
45-
"apiVersion": "2021-10-01",
46-
"name": "[parameters('clusterName')]",
47-
"location": "[parameters('location')]",
48-
"identity": {
49-
"type": "UserAssigned",
50-
"userAssignedIdentities": {
51-
"[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName')))]": {}
52-
}
45+
"type": "Microsoft.ContainerService/managedClusters",
46+
"apiVersion": "2024-01-01",
47+
"name": "[parameters('name')]",
48+
"location": "[parameters('location')]",
49+
"identity": {
50+
"type": "UserAssigned",
51+
"userAssignedIdentities": {
52+
"[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName')))]": {}
53+
}
54+
},
55+
"properties": {
56+
"kubernetesVersion": "[parameters('kubernetesVersion')]",
57+
"disableLocalAccounts": true,
58+
"enableRBAC": true,
59+
"dnsPrefix": "[parameters('dnsPrefix')]",
60+
"agentPoolProfiles": [
61+
{
62+
"name": "system",
63+
"osDiskSizeGB": 0,
64+
"minCount": 3,
65+
"maxCount": 5,
66+
"enableAutoScaling": true,
67+
"maxPods": 50,
68+
"vmSize": "Standard_D4s_v5",
69+
"type": "VirtualMachineScaleSets",
70+
"vnetSubnetID": "[parameters('clusterSubnetId')]",
71+
"mode": "System",
72+
"osDiskType": "Ephemeral"
73+
},
74+
{
75+
"name": "user",
76+
"osDiskSizeGB": 0,
77+
"minCount": 3,
78+
"maxCount": 20,
79+
"enableAutoScaling": true,
80+
"maxPods": 50,
81+
"vmSize": "Standard_D4s_v5",
82+
"type": "VirtualMachineScaleSets",
83+
"vnetSubnetID": "[parameters('clusterSubnetId')]",
84+
"mode": "User",
85+
"osDiskType": "Ephemeral"
86+
}
87+
],
88+
"aadProfile": {
89+
"managed": true,
90+
"enableAzureRBAC": true,
91+
"adminGroupObjectIDs": "[parameters('clusterAdmins')]",
92+
"tenantID": "[subscription().tenantId]"
5393
},
54-
"properties": {
55-
"kubernetesVersion": "[parameters('kubernetesVersion')]",
56-
"enableRBAC": true,
57-
"dnsPrefix": "[parameters('dnsPrefix')]",
58-
"agentPoolProfiles": "[variables('allPools')]",
59-
"aadProfile": {
60-
"managed": true,
61-
"enableAzureRBAC": true,
62-
"adminGroupObjectIDs": "[parameters('clusterAdmins')]",
63-
"tenantID": "[subscription().tenantId]"
64-
},
65-
"networkProfile": {
66-
"networkPlugin": "azure",
67-
"networkPolicy": "azure",
68-
"loadBalancerSku": "standard",
69-
"serviceCidr": "[variables('serviceCidr')]",
70-
"dnsServiceIP": "[variables('dnsServiceIP')]",
71-
"dockerBridgeCidr": "[variables('dockerBridgeCidr')]"
72-
},
73-
"autoUpgradeProfile": {
74-
"upgradeChannel": "stable"
75-
},
76-
"addonProfiles": {
77-
"httpApplicationRouting": {
78-
"enabled": false
79-
},
80-
"azurepolicy": {
81-
"enabled": true,
82-
"config": {
83-
"version": "v2"
84-
}
85-
},
86-
"omsagent": {
87-
"enabled": true,
88-
"config": {
89-
"logAnalyticsWorkspaceResourceID": "[parameters('workspaceId')]"
90-
}
91-
},
92-
"kubeDashboard": {
93-
"enabled": false
94-
},
95-
"azureKeyvaultSecretsProvider": {
96-
"enabled": true,
97-
"config": {
98-
"enableSecretRotation": "true"
99-
}
100-
}
101-
},
102-
"podIdentityProfile": {
103-
"enabled": true
104-
}
94+
"networkProfile": {
95+
"networkPlugin": "azure",
96+
"networkPolicy": "azure",
97+
"loadBalancerSku": "standard",
98+
"serviceCidr": "[variables('serviceCidr')]",
99+
"dnsServiceIP": "[variables('dnsServiceIP')]"
105100
},
106-
"tags": "[parameters('tags')]",
107-
"dependsOn": [
108-
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName'))]"
109-
]
101+
"apiServerAccessProfile": {
102+
"enablePrivateCluster": true,
103+
"enablePrivateClusterPublicFQDN": false
104+
},
105+
"autoUpgradeProfile": {
106+
"upgradeChannel": "stable"
107+
},
108+
"oidcIssuerProfile": {
109+
"enabled": true
110+
},
111+
"addonProfiles": {
112+
"azurepolicy": {
113+
"enabled": true
114+
},
115+
"omsagent": {
116+
"enabled": true,
117+
"config": {
118+
"logAnalyticsWorkspaceResourceID": "[parameters('workspaceId')]"
119+
}
120+
},
121+
"azureKeyvaultSecretsProvider": {
122+
"enabled": true,
123+
"config": {
124+
"enableSecretRotation": "true"
125+
}
126+
}
127+
}
128+
},
129+
"dependsOn": [
130+
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('identityName'))]"
131+
]
110132
}
111133
```
112134

@@ -119,9 +141,9 @@ To deploy AKS clusters that pass this rule:
119141
For example:
120142

121143
```bicep
122-
resource cluster 'Microsoft.ContainerService/managedClusters@2021-10-01' = {
144+
resource privateCluster 'Microsoft.ContainerService/managedClusters@2024-01-01' = {
123145
location: location
124-
name: clusterName
146+
name: name
125147
identity: {
126148
type: 'UserAssigned'
127149
userAssignedIdentities: {
@@ -130,9 +152,37 @@ resource cluster 'Microsoft.ContainerService/managedClusters@2021-10-01' = {
130152
}
131153
properties: {
132154
kubernetesVersion: kubernetesVersion
155+
disableLocalAccounts: true
133156
enableRBAC: true
134157
dnsPrefix: dnsPrefix
135-
agentPoolProfiles: allPools
158+
agentPoolProfiles: [
159+
{
160+
name: 'system'
161+
osDiskSizeGB: 0
162+
minCount: 3
163+
maxCount: 5
164+
enableAutoScaling: true
165+
maxPods: 50
166+
vmSize: 'Standard_D4s_v5'
167+
type: 'VirtualMachineScaleSets'
168+
vnetSubnetID: clusterSubnetId
169+
mode: 'System'
170+
osDiskType: 'Ephemeral'
171+
}
172+
{
173+
name: 'user'
174+
osDiskSizeGB: 0
175+
minCount: 3
176+
maxCount: 20
177+
enableAutoScaling: true
178+
maxPods: 50
179+
vmSize: 'Standard_D4s_v5'
180+
type: 'VirtualMachineScaleSets'
181+
vnetSubnetID: clusterSubnetId
182+
mode: 'User'
183+
osDiskType: 'Ephemeral'
184+
}
185+
]
136186
aadProfile: {
137187
managed: true
138188
enableAzureRBAC: true
@@ -145,53 +195,55 @@ resource cluster 'Microsoft.ContainerService/managedClusters@2021-10-01' = {
145195
loadBalancerSku: 'standard'
146196
serviceCidr: serviceCidr
147197
dnsServiceIP: dnsServiceIP
148-
dockerBridgeCidr: dockerBridgeCidr
198+
}
199+
apiServerAccessProfile: {
200+
enablePrivateCluster: true
201+
enablePrivateClusterPublicFQDN: false
149202
}
150203
autoUpgradeProfile: {
151204
upgradeChannel: 'stable'
152205
}
206+
oidcIssuerProfile: {
207+
enabled: true
208+
}
153209
addonProfiles: {
154-
httpApplicationRouting: {
155-
enabled: false
156-
}
157210
azurepolicy: {
158211
enabled: true
159-
config: {
160-
version: 'v2'
161-
}
162212
}
163213
omsagent: {
164214
enabled: true
165215
config: {
166216
logAnalyticsWorkspaceResourceID: workspaceId
167217
}
168218
}
169-
kubeDashboard: {
170-
enabled: false
171-
}
172219
azureKeyvaultSecretsProvider: {
173220
enabled: true
174221
config: {
175222
enableSecretRotation: 'true'
176223
}
177224
}
178225
}
179-
podIdentityProfile: {
180-
enabled: true
181-
}
182226
}
183-
tags: tags
184227
}
185228
```
186229

230+
### Configure with Azure Policy
231+
232+
To address this issue at runtime use the following policies:
233+
234+
- [Azure Policy Add-on for Kubernetes service (AKS) should be installed and enabled on your clusters](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Kubernetes/AKS_AzurePolicyAddOn_Audit.json)
235+
`/providers/Microsoft.Authorization/policyDefinitions/0a15ec92-a229-4763-bb14-0ea34a568f8d`
236+
- [Deploy Azure Policy Add-on to Azure Kubernetes Service clusters](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Kubernetes/AKS_AzurePolicyAddOn_DINE.json)
237+
`/providers/Microsoft.Authorization/policyDefinitions/a8eff44f-8c92-45c3-a3fb-9880802d67a7`
238+
187239
## NOTES
188240

189241
Azure Policy for AKS clusters is generally available (GA).
190242
Azure Policy for AKS Engine and Arc enabled Kubernetes are currently in preview.
191243

192244
## LINKS
193245

194-
- [Governance, risk, and compliance](https://learn.microsoft.com/azure/architecture/framework/security/governance#audit-and-enforce-policy-compliance)
195-
- [Understand Azure Policy for Kubernetes clusters](https://docs.microsoft.com/azure/governance/policy/concepts/policy-for-kubernetes)
196-
- [Secure your cluster with Azure Policy](https://docs.microsoft.com/azure/aks/use-azure-policy)
197-
- [Azure deployment reference](https://docs.microsoft.com/azure/templates/microsoft.containerservice/managedclusters)
246+
- [SE:08 Hardening resources](https://learn.microsoft.com/azure/well-architected/security/harden-resources)
247+
- [Understand Azure Policy for Kubernetes clusters](https://learn.microsoft.com/azure/governance/policy/concepts/policy-for-kubernetes)
248+
- [Secure your Azure Kubernetes Service (AKS) clusters with Azure Policy](https://learn.microsoft.com/azure/aks/use-azure-policy)
249+
- [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.containerservice/managedclusters)

docs/en/rules/Azure.AKS.LocalAccounts.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,8 @@ az aks update -n '<name>' -g '<resource_group>' --enable-aad --aad-admin-group-o
232232

233233
To address this issue at runtime use the following policies:
234234

235-
```text
236-
/providers/Microsoft.Authorization/policyDefinitions/993c2fcd-2b29-49d2-9eb0-df2c3a730c32
237-
```
235+
- [Azure Kubernetes Service Clusters should have local authentication methods disabled](https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Kubernetes/AKS_DisableLocalAccounts_Deny.json)
236+
`/providers/Microsoft.Authorization/policyDefinitions/993c2fcd-2b29-49d2-9eb0-df2c3a730c32`
238237

239238
## LINKS
240239

0 commit comments

Comments
 (0)