Azure Kubernetes Service (AKS)¶
Status: verified. Priority: P2. Last verified: 21 Nov 2026.
What it is¶
Azure Kubernetes Service (AKS) runs managed Kubernetes clusters on Azure. Its control plane audit logs show interactive kubectl exec into pods, RBAC edits, privileged workload creation and secret access, while Microsoft Defender for Containers monitors both the Kubernetes API and node runtime syscalls for container escapes, web shells and crypto-mining.
Key recommendations¶
- Always choose Resource specific destination tables in AKS diagnostic settings, never legacy
AzureDiagnostics. Resource-specific mode gives you clean typed columns inAKSAuditAdmin,AKSAuditandAKSControlPlaneinstead of raw JSON strings (Microsoft Learn). - Send
kube-audit-admin(AKSAuditAdmin) to the Analytics tier as your default day-1 audit log. It excludes noisygetandlistverbs while keeping everycreate,update,patch,deleteandpods/execaction (table reference). - Treat full
kube-audit(AKSAudit) deliberately. It includes everygetandlistrequest and generates huge volume. Only turn it on if you specifically need to alert or hunt onget/listof Kubernetessecrets, and send it to the Data lake tier (or filter it tosecretswith a workspace transformation DCR). Don't enable bothkube-auditandkube-audit-adminunfiltered into Analytics, or you'll pay twice for every write event. - Enable Microsoft Defender for Containers and stream its alerts into Sentinel (
SecurityAlert). Defender for Containers analyses AKS control-plane audit logs agentlessly on Microsoft's side (no diagnostic setting needed) and runs a lightweight DaemonSet runtime sensor on nodes for process, file and network threats. Its alerts are free to ingest into Sentinel (Microsoft Learn). - Keep
ContainerLogV2(containerstdout/stderrfrom Container insights) in the Data lake tier or Basic/Auxiliary logs, not Analytics. Application container logs are high volume and best suited to post-incident investigation. - Connect Azure Activity (
AzureActivity) to catch cluster-level control-plane abuse, especially calls tolistClusterAdminCredentialthat pull static cluster-admin kubeconfigs and bypass Entra RBAC.
High-value log sources¶
AKS diagnostic categories route to resource-specific tables when you pick Resource specific in diagnostic settings. Container stdout/stderr comes from Container insights via Azure Monitor Agent (AMA), and runtime/control-plane threat alerts come from Defender for Containers.
| Source | Table name | Connector | Tier | Cost / volume | Value |
|---|---|---|---|---|---|
| Kubernetes audit (admin) | AKSAuditAdmin |
Azure Kubernetes Service (diagnostic settings, kube-audit-admin) |
Analytics | Low to medium. Excludes get and list verbs |
Best cost-to-signal AKS table. Catches pods/exec, RBAC role bindings, privileged pod creation and config changes (table reference). |
| Kubernetes audit (full) | AKSAudit |
Azure Kubernetes Service (diagnostic settings, kube-audit) |
Data lake (or skip unless hunting secrets reads) |
Very high. Logs every get and list API call |
Superset of AKSAuditAdmin. Only needed if you must track read-only get/list of Kubernetes secrets or ConfigMaps (table reference). |
| Control plane and Guard | AKSControlPlane |
Azure Kubernetes Service (diagnostic settings: guard, kube-apiserver, kube-controller-manager, kube-scheduler) |
Data lake | Medium to high | Control plane component logs. Includes the guard category (Entra authentication/authorisation webhook); there is no separate AKSGuard table (table reference). |
| Container stdout/stderr | ContainerLogV2 |
Container insights (Azure Monitor Agent) | Data lake | Very high. Every container stdout/stderr line | Application-level forensics after a pod compromise. Successor to legacy ContainerLog, with 64 KB lines and KubernetesMetadata (table reference). |
| Defender for Containers alerts | SecurityAlert |
Microsoft Defender for Cloud | Analytics | Free Sentinel ingestion. Plan billed per protected vCore per hour | Control-plane and node runtime threat alerts: container escape, reverse shells, web shells, crypto-mining, privileged containers (Microsoft Learn). |
| AKS Azure control plane | AzureActivity |
Azure Activity | Analytics | Free Sentinel ingestion, low volume | Tracks listClusterAdminCredential, cluster RBAC changes, network policy edits and diagnostic setting removals (table reference). |
What to ingest first¶
| Priority | Table | Why | Rough volume | Tier |
|---|---|---|---|---|
| 1 | SecurityAlert (Defender for Containers) + AzureActivity |
Free Sentinel ingestion; immediate runtime, control-plane and kubeconfig-pull coverage | Low | Analytics |
| 2 | AKSAuditAdmin |
Every mutating API call (exec, RBAC, deployments) without get/list noise |
Low to medium | Analytics |
| 3 | AKSControlPlane (guard first) |
Entra auth webhook diagnostics and control-plane troubleshooting | Medium | Data lake |
| 4 | ContainerLogV2 |
Post-incident pod forensics | Very high | Data lake |
| 5 | AKSAudit |
Only if compliance or threat model requires tracking get/list on secrets |
Very high | Data lake (or DCR-filtered to secrets) |
| Skip | Legacy ContainerLog, kube-audit unfiltered in Analytics |
Superseded schema or unsustainable cost | High to very high | Migrate to ContainerLogV2 and AKSAuditAdmin |
Prerequisites and licensing¶
| Item | Detail |
|---|---|
| AKS diagnostic logs | No extra AKS licence required. You pay Log Analytics and Sentinel ingestion for AKSAuditAdmin, AKSAudit and AKSControlPlane (Monitor AKS). |
Container insights (ContainerLogV2) |
Uses Azure Monitor Agent (AMA) managed by AKS Container insights. Billed on Log Analytics ingestion volume; set the table plan to Basic/Data lake where possible to control cost (ContainerLogV2 schema). |
| Microsoft Defender for Containers | Paid plan in Microsoft Defender for Cloud, billed per protected vCore per hour across cluster nodes (includes a monthly container registry image scan allowance per vCore). Alerts forwarded to Sentinel incur no Sentinel ingestion charge (Microsoft Learn). |
Entra ID integration (guard) |
Managed Microsoft Entra ID integration on AKS is recommended so AKSAuditAdmin records real user UPNs/object IDs rather than shared certificate identities. |
Roles you need¶
| Task | Role |
|---|---|
| Install Content Hub solutions and create rules | Microsoft Sentinel Contributor on the resource group (Microsoft Learn) |
| Configure AKS diagnostic settings and Container insights | Azure Kubernetes Service Contributor Role (plus Monitoring Contributor / Log Analytics Contributor on the workspace) |
| Assign Azure Policy for diagnostic settings at scale | Resource Policy Contributor at subscription or management group scope (Microsoft Learn) |
| Enable Defender for Containers and deploy the runtime sensor | Security Admin or Subscription Owner on the subscription (Microsoft Learn) |
Step-by-step setup¶
- Install Content Hub solutions. In the Defender portal, go to Microsoft Sentinel > Content management > Content hub. Install Microsoft Defender for Cloud and Azure Activity, plus Azure Kubernetes Service if listed in your workspace catalogue (Microsoft Learn).
- Enable Defender for Containers. In Microsoft Defender for Cloud > Environment settings, select your subscriptions and enable the Containers plan with auto-provisioning turned on for the Defender sensor (DaemonSet) and Azure Policy for Kubernetes. Then connect the tenant-based Microsoft Defender for Cloud connector in Sentinel (Microsoft Learn).
- Configure AKS resource-specific diagnostic settings. In the Azure portal, open your AKS cluster > Monitoring > Diagnostic settings > + Add diagnostic setting.
- Select kube-audit-admin (writes to
AKSAuditAdmin) and guard (writes toAKSControlPlane). Addkube-apiserverif you want API server operational diagnostics in Data lake. - Under Destination details, tick Send to Log Analytics workspace, choose your Sentinel workspace, and set Destination table to Resource specific (critical: do not leave it on
AzureDiagnostics). - Save (Microsoft Learn).
- Apply across clusters with Azure Policy. In the Defender portal, open Setup & configuration > Data management > Data & connectors > Connectors > Classic connectors - Microsoft Sentinel > Azure Kubernetes Service (AKS) > Open connector page, and assign the built-in Azure Policy to deploy resource-specific diagnostic settings across all clusters (Microsoft Learn).
- Configure Container insights with
ContainerLogV2(optional, Data lake tier). On the AKS cluster, open Monitoring > Insights, enable Container insights pointing to your workspace, and confirmContainerLogV2schema is enabled. SetContainerLogV2to Data lake or Basic retention in table management so verbose container stdout doesn't consume Analytics budget (Microsoft Learn). - Connect Azure Activity. Ensure Azure Activity is streaming from every subscription hosting AKS clusters so
listClusterAdminCredentialand cluster config changes are captured. - Validate. Run a benign
kubectlmutation (such as labelling a test pod in a dev namespace), wait 5 to 15 minutes, then run the validation KQL below in the Defender portal under Investigation & response > Advanced hunting.
Best-practice security configuration¶
Combine AKSAuditAdmin logging with Microsoft Defender for Containers and cluster admission controls. See Defender best-practice security configurations.
- Agentless discovery + Defender sensor: Enable both agentless Kubernetes discovery and the eBPF Defender sensor DaemonSet for runtime threat detection and binary drift alerts (Defender for Containers).
- Registry vulnerability scanning: Enable continuous container image scanning on Azure Container Registry and block or alert on critical CVEs before deployment.
- Admission control: Enable the Azure Policy add-on for AKS and enforce the built-in Kubernetes cluster pod security restricted standards (block privileged pods, hostPath mounts and root escalation).
- Control plane hardening: Enforce Microsoft Entra ID RBAC, disable local Kubernetes accounts (
--disable-local-accounts), and restrict API server access with authorised IP ranges or private AKS clusters.
Architecture diagram¶
flowchart LR
AKS[AKS cluster] --> DIAG[Diagnostic settings: Resource specific]
AKS --> AMA[Container insights AMA]
AKS --> MDC[Defender for Containers]
ARM[Azure Resource Manager] --> ACT[Azure Activity]
DIAG --> WS[Sentinel workspace]
AMA --> WS
MDC --> WS
ACT --> WS
subgraph AN[Analytics tier]
T1[AKSAuditAdmin]
T2[SecurityAlert]
T3[AzureActivity]
end
subgraph LK[Data lake tier]
T4[AKSAudit]
T5[AKSControlPlane]
T6[ContainerLogV2]
end
WS --> AN
WS --> LK
AN --> RULES[Analytic rules]
LK --> HUNT[Hunting and forensics]
RULES --> INC[Incidents]
Validation KQL¶
For group-wide and workspace-wide freshness checks, see azure.kql and the validation query pack.
// 1. Check which AKS tables are landing and how fresh they are
// Note: Tables set to data lake only do not appear here; check Data lake explorer for those.
union withsource=Table isfuzzy=true
AKSAuditAdmin, AKSAudit, AKSControlPlane, ContainerLogV2
| where TimeGenerated > ago(1d)
| summarize Rows = count(), Latest = max(TimeGenerated) by Table
| order by Table asc
// 2. Freshness check on AKSAuditAdmin (should be minutes old on active clusters)
AKSAuditAdmin
| summarize Latest = max(TimeGenerated), AgeMinutes = (now() - max(TimeGenerated)) / 1m
// 3. Verify Defender for Containers alerts are arriving in SecurityAlert
SecurityAlert
| where TimeGenerated > ago(30d)
| where ProductName has "Container" or ProductComponentName has "Kubernetes" or ProviderName has "MDC"
| summarize Alerts = count(), Latest = max(TimeGenerated) by AlertName
| order by Alerts desc
// 4. Confirm guard logs are landing inside AKSControlPlane (not a separate table)
AKSControlPlane
| where TimeGenerated > ago(1d)
| summarize Events = count() by Category
| order by Events desc
// 5. Cost: GB per table per day over the last 30 days
Usage
| where TimeGenerated > ago(30d)
| where DataType in ("AKSAuditAdmin", "AKSAudit", "AKSControlPlane", "ContainerLogV2", "SecurityAlert")
| summarize GB = round(sum(Quantity) / 1024, 2) by DataType, Day = bin(TimeGenerated, 1d)
| summarize GBperDay = round(avg(GB), 2), TotalGB30d = round(sum(GB), 2) by DataType
| order by GBperDay desc
Out-of-box analytic rules¶
AKS diagnostic logs ship with very few standalone Sentinel analytic rule templates compared to identity sources. Your primary out-of-box detection coverage comes from Microsoft Defender for Containers alerts promoted via the Microsoft Defender for Cloud solution (solution folder) and control-plane rules in the Azure Activity solution (Azure Activity solution). Pair those with the custom AKSAuditAdmin rules below.
| Rule | Detects | Tables | MITRE | Suggested |
|---|---|---|---|---|
| Create incidents based on Microsoft Defender for Cloud alerts | Promotes Defender for Containers runtime and API alerts (container escape, web shell, crypto-mining, privileged container, exposed Kubernetes dashboard) into Sentinel incidents | SecurityAlert |
Execution, Privilege Escalation, Defense Evasion, Impact | Enable day 1 |
| Azure Activity diagnostic setting or RBAC rules (Azure Activity solution) | Control-plane tampering across subscriptions hosting AKS clusters | AzureActivity |
Persistence, Defense Evasion | Enable day 1 |
Custom detections¶
Run hourly with a 1-hour lookback unless noted. AKSAuditAdmin uses typed dynamic columns (User, ObjectRef, ResponseStatus, SourceIps) documented in the AKSAuditAdmin table reference.
C1. Interactive exec or attach into a Kubernetes pod (Medium, High in production)¶
Attackers who obtain cluster credentials frequently run kubectl exec into running pods to steal mounted tokens, pivot or drop tools.
// CUSTOM - Interactive exec or attach into a pod in AKS
// ASSUMPTION: Resource-specific diagnostic setting kube-audit-admin is enabled (writes to AKSAuditAdmin).
// Filter approved break-glass or SRE accounts via a watchlist after baselining.
let approved_users = dynamic(["sre-breakglass@yourdomain.gov.au"]);
AKSAuditAdmin
| where TimeGenerated > ago(1h)
| where Verb in ("create", "get")
| where tostring(ObjectRef.resource) == "pods"
and tostring(ObjectRef.subresource) in ("exec", "attach")
| extend Username = tostring(User.username),
Namespace = tostring(ObjectRef.namespace),
PodName = tostring(ObjectRef.name),
ResponseCode = toint(ResponseStatus.code)
| where ResponseCode between (100 .. 299)
| where Username !startswith "system:"
| where Username !in~ (approved_users)
| project TimeGenerated, Cluster = _ResourceId, Username, Namespace, PodName,
Subresource = tostring(ObjectRef.subresource), RequestUri, SourceIps, ResponseCode
MITRE: Execution, Container Administration Command T1609.
C2. ClusterRoleBinding created or modified for privileged access (High)¶
Creating or modifying a ClusterRoleBinding (especially binding cluster-admin) grants cluster-wide control and is a classic Kubernetes persistence technique.
// CUSTOM - ClusterRoleBinding created, updated or patched outside system controllers
// ASSUMPTION: Verify your GitOps controller service account name (e.g. Flux or ArgoCD) and add to allow list.
let gitops_accounts = dynamic(["system:serviceaccount:flux-system:kustomize-controller"]);
AKSAuditAdmin
| where TimeGenerated > ago(1h)
| where Verb in ("create", "update", "patch")
| where tostring(ObjectRef.resource) in ("clusterrolebindings", "rolebindings")
| extend Username = tostring(User.username),
BindingName = tostring(ObjectRef.name),
Namespace = tostring(ObjectRef.namespace),
ResponseCode = toint(ResponseStatus.code)
| where ResponseCode between (200 .. 299)
| where Username !startswith "system:apiserver"
and Username !startswith "system:kube-controller-manager"
and Username !in~ (gitops_accounts)
| project TimeGenerated, Cluster = _ResourceId, Verb, Username,
ResourceType = tostring(ObjectRef.resource), Namespace, BindingName, SourceIps, RequestUri
MITRE: Privilege Escalation and Persistence, Account Manipulation T1098.
C3. Static AKS cluster-admin credentials retrieved via Azure API (High)¶
Calling listClusterAdminCredential returns a static certificate-based cluster-admin kubeconfig that bypasses Entra ID Conditional Access and RBAC unless local accounts are disabled.
// CUSTOM - Retrieval of AKS static cluster-admin credentials via Azure Resource Manager
// ASSUMPTION: AzureActivity is connected for subscriptions hosting AKS clusters.
AzureActivity
| where TimeGenerated > ago(1h)
| where ActivityStatusValue in ("Success", "Succeeded")
| where OperationNameValue =~ "Microsoft.ContainerService/managedClusters/listClusterAdminCredential/action"
| project TimeGenerated, Caller, CallerIpAddress, SubscriptionId, ResourceGroup, Cluster = _ResourceId
If local accounts are disabled (--disable-local-accounts), this API call fails and any successful occurrence is an immediate severity-high incident. MITRE: Credential Access, Steal Application Access Token / Valid Accounts T1078.004.
Playbooks¶
No AKS-specific containment playbooks ship out of the box. Common Logic App patterns to build:
| Playbook pattern | What it does | Connectors and permissions |
|---|---|---|
| Enrich AKS alert with audit trail | Queries AKSAuditAdmin for the caller or pod over the preceding 2 hours and appends a comment to the Sentinel incident |
Azure Monitor Logs connector (Log Analytics Reader), Microsoft Sentinel Responder |
| Revoke compromised Entra caller | Calls Revoke-AADSignInSessions and optionally Block-AADUser from the Microsoft Entra ID solution when an Entra user triggers a high-severity AKS alert |
Microsoft Graph (User.ReadWrite.All), Microsoft Sentinel Responder |
| Isolate node or notify platform team | Posts incident context (cluster, namespace, pod, image, caller) to the Kubernetes platform on-call channel for rapid pod eviction or network policy isolation | Teams / Slack / PagerDuty connector, Microsoft Sentinel Responder |
Workbooks and hunting¶
- AKS Guided Hunting notebook. Microsoft publishes the interactive
Azure Kubernetes Service Guided Hunting.ipynbnotebook covering container escapes, suspicious API calls and privilege escalation hunts (Azure-Sentinel-Notebooks). - Container insights workbooks. In the Azure portal, open your AKS cluster > Monitoring > Workbooks for built-in operational views over
ContainerLogV2and cluster health. - Recommended hunt: Anonymous or failed API authentication spikes. Hunt
AKSAuditAdminfor401and403bursts indicating probing or misconfigured/stolen service account tokens:
AKSAuditAdmin
| where TimeGenerated > ago(7d)
| extend ResponseCode = toint(ResponseStatus.code), Username = tostring(User.username)
| where ResponseCode in (401, 403)
| summarize Attempts = count(), Targets = make_set(tostring(ObjectRef.resource), 10)
by Username, SourceIp = tostring(SourceIps[0]), ResponseCode, Cluster = _ResourceId
| where Attempts >= 20
| order by Attempts desc
Gotchas and deprecations¶
AKSGuardis not a standalone table. Enabling theguarddiagnostic log category writes rows intoAKSControlPlane(withCategory == "guard"), not a separateAKSGuardtable (AKSControlPlane reference).- Full
kube-audit(AKSAudit) is extremely noisy. Because it logs everygetandlistfrom Kubernetes controllers, operators and dashboards, it can generate gigabytes per hour per cluster. UseAKSAuditAdmin(kube-audit-admin) for Analytics, and only sendAKSAuditto Data lake or filter it with a workspace transformation DCR. - Avoid enabling both
kube-auditandkube-audit-adminto Analytics.kube-auditalready includes every mutating event inkube-audit-admin. Enabling both unfiltered duplicates write events and increases spend. - Resource-specific versus
AzureDiagnostics. If you leave the diagnostic setting onAzureDiagnostics, AKS audit logs land as unparsed JSON insidelog_sand none of the typed queries againstAKSAuditAdminwill match. Always select Resource specific (Monitor AKS). ContainerLogversusContainerLogV2.ContainerLogV2replaces the legacyContainerLogschema with stitched multiline logs, 64 KB line limits and structuredKubernetesMetadata. EnableContainerLogV2for all clusters using Container insights (schema reference).- Defender for Containers does not require your diagnostic setting. Defender for Containers inspects AKS control-plane audit logs through its own Azure-managed pipeline, so its alerts still work even if you haven't enabled
AKSAuditAdmin. You still needAKSAuditAdminfor custom detections and forensic timeline reconstruction. - Sentinel in the Azure portal retires on 31 March 2027. Build and manage rules in the Defender portal (Microsoft Learn).
Official links¶
- Monitor Azure Kubernetes Service (AKS)
- Monitoring Azure Kubernetes Service (AKS) data reference
- AKSAuditAdmin table reference
- AKSAudit table reference
- AKSControlPlane table reference
- ContainerLogV2 table reference
- ContainerLogV2 schema in Container insights
- Introduction to Microsoft Defender for Containers
- Connect Sentinel to Azure services using diagnostic settings
- Connect Microsoft Defender for Cloud to Microsoft Sentinel
- Azure Kubernetes Service Guided Hunting notebook
- Microsoft Defender for Cloud solution, Azure-Sentinel repo
- Azure Activity solution, Azure-Sentinel repo
- Microsoft Sentinel in the Defender portal
Last verified¶
21 Nov 2026, against Microsoft Learn and the Azure-Sentinel repo. Re-verify before relying on table names, navigation or rule names.