Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// Azure Resource Graph Query
// Returns each AKS cluster with nodepools that have user nodepools with less than 2 nodes
resources
| where type == "microsoft.containerservice/managedclusters"
| where type =~ "Microsoft.ContainerService/managedClusters"
| mv-expand agentPoolProfile = properties.agentPoolProfiles
| extend taints = tostring(parse_json(agentPoolProfile.nodeTaints))
| extend nodePool = tostring(parse_json(agentPoolProfile.name))
| where taints !has "CriticalAddonsOnly=true:NoSchedule" and agentPoolProfile.minCount < 2
| project recommendationId="005ccbbd-aeab-46ef-80bd-9bd4479412ec", name, id=id, tags,param1=strcat("nodePoolName: ", nodePool), param2=strcat("nodePoolMinNodeCount: ", agentPoolProfile.minCount)
| extend
taints = tostring(parse_json(agentPoolProfile.nodeTaints)),
nodePool = tostring(parse_json(agentPoolProfile.name))
| where taints !has "CriticalAddonsOnly=true:NoSchedule"
| where (agentPoolProfile.enableAutoScaling == true and agentPoolProfile["minCount"] < 2) or (agentPoolProfile.enableAutoScaling == false and agentPoolProfile["count"] < 2)
Comment thread
tksh164 marked this conversation as resolved.
Comment thread
tksh164 marked this conversation as resolved.
| project
recommendationId = "005ccbbd-aeab-46ef-80bd-9bd4479412ec",
name,
id,
tags,
param1 = strcat("nodePoolName: ", nodePool),
param2 = strcat("enableAutoScaling: ", agentPoolProfile.enableAutoScaling),
param3 = iff(tobool(agentPoolProfile.enableAutoScaling), strcat("nodePoolMinNodeCount: ", agentPoolProfile["minCount"]), strcat("nodePoolNodeCount: ", agentPoolProfile["count"]))