← Back to Explore
elasticmediumTTP
Azure AKS Multi-Resource Setup Discovery
Detects an AKS (Azure Kubernetes Service) identity that lists or gets multiple distinct Kubernetes API resource types associated with cluster orientation (namespaces, nodes, pods, roles, clusterroles, configmaps, serviceaccounts, rolebindings, clusterrolebindings) within a short window. Cardinality of distinct resources touched, not raw event count, is the signal that separates recon/orientation behavior from steady-state controllers that repeatedly touch a narrow set of resources. Known platform and control-plane identities are excluded.
Detection Query
from logs-azure.platformlogs-* metadata _id, _index, _version
| where data_stream.dataset == "azure.platformlogs"
and event.action == "Microsoft.ContainerService/managedClusters/diagnosticLogs/Read"
and azure.platformlogs.category == "kube-audit"
| eval Esql.stage = field_extract(azure.platformlogs.properties, "log.stage"),
Esql.verb = field_extract(azure.platformlogs.properties, "log.verb"),
Esql.resource = field_extract(azure.platformlogs.properties, "log.objectRef.resource"),
Esql.namespace = field_extract(azure.platformlogs.properties, "log.objectRef.namespace"),
Esql.username = field_extract(azure.platformlogs.properties, "log.user.username"),
Esql.user_agent = field_extract(azure.platformlogs.properties, "log.userAgent"),
Esql.source_ips = field_extract(azure.platformlogs.properties, "log.sourceIPs")
| where Esql.stage == "ResponseComplete"
and Esql.verb in ("list", "get")
and Esql.resource in ("namespaces", "nodes", "pods", "roles", "clusterroles", "configmaps", "serviceaccounts", "rolebindings", "clusterrolebindings")
and Esql.username is not null
and (Esql.namespace is null or Esql.namespace != "elastic-system")
and not Esql.username rlike "system:node:.*|system:serviceaccount:kube-system:.*|system:serviceaccount:elastic-system:.*"
and not Esql.username in ("aksService", "hcpService", "readinessChecker", "acsService", "system:apiserver", "system:kube-controller-manager", "system:kube-scheduler")
and not Esql.user_agent rlike """(resourcesyncoperator|identityOperator|telegraf|clustermetadatasync|ConfigurationAgent|manager|extensionmanager)/.*\(linux/amd64\) kubernetes/\$Format|Helm/.*|.*Terraform.*|OpenAPI-Generator/.*"""
| eval Esql.namespace = coalesce(Esql.namespace, "(cluster-scoped)")
| stats
Esql.unique_resources = count_distinct(Esql.resource),
Esql.enumerated_resources = values(Esql.resource),
Esql.enumerated_namespaces = values(Esql.namespace),
Esql.source_ip_values = values(Esql.source_ips),
Esql.username_values = values(Esql.username),
Esql.event_count = count(*),
Esql.earliest_timestamp = min(@timestamp),
Esql.latest_timestamp = max(@timestamp)
by Esql.username, Esql.user_agent, azure.resource.id
| where Esql.unique_resources >= 3
| keep Esql.*, azure.resource.id
Author
Elastic
Created
2026/08/04
Data Sources
AzureAzure Platform LogsKubernetes
Tags
Domain: CloudDomain: KubernetesData Source: AzureData Source: Azure Platform LogsData Source: KubernetesUse Case: Threat DetectionTactic: DiscoveryResources: Investigation GuideRule Type: ES|QLPlatform: AzurePlatform: Kubernetes
Raw Content
[metadata]
creation_date = "2026/08/04"
integration = ["azure"]
maturity = "production"
min_stack_comments = "field_extract not available until 9.5.0"
min_stack_version = "9.5.0"
updated_date = "2026/10/28"
[rule]
author = ["Elastic"]
description = """
Detects an AKS (Azure Kubernetes Service) identity that lists or gets multiple distinct Kubernetes API resource types
associated with cluster orientation (namespaces, nodes, pods, roles, clusterroles, configmaps, serviceaccounts,
rolebindings, clusterrolebindings) within a short window. Cardinality of distinct resources touched, not raw event
count, is the signal that separates recon/orientation behavior from steady-state controllers that repeatedly touch a
narrow set of resources. Known platform and control-plane identities are excluded.
"""
false_positives = [
"""
GitOps, backup, and platform operators may span these resource types during sync. Exclude validated service accounts
or raise the cardinality threshold after baselining.
""",
]
from = "now-9m"
language = "esql"
license = "Elastic License v2"
name = "Azure AKS Multi-Resource Setup Discovery"
note = """## Triage and analysis
### Investigating Azure AKS Multi-Resource Setup Discovery
AKS kube-audit events are carried under the flattened `azure.platformlogs.properties.log.*` subtree, so this rule uses
`field_extract` to pull `stage`, `verb`, `objectRef.resource`, `objectRef.namespace`, `user.username`, `userAgent`,
and `sourceIPs` into named `Esql.*`/`Esql.*` fields. It groups `ResponseComplete`-stage `list`/`get` calls on
orientation-related resources by `Esql.username`, `Esql.user_agent`, and `azure.resource.id` (the AKS cluster),
and alerts when the distinct `Esql.resource` cardinality for that identity/client fingerprint is 3 or greater,
mirroring the Kubernetes ES|QL multi-resource discovery rule. Scoping by cluster keeps same-named identities (for
example the default `masterclient` admin or a GitOps service account deployed to several clusters) from pooling
across clusters and reaching the threshold on unrelated activity. Source IPs are not part of the group key because
AKS `sourceIPs` carries the client IP alongside a control-plane proxy address (`172.31.x.x`) that varies across proxy
replicas within a single session; they are instead collected into `Esql.source_ip_values` for triage. Known
platform/control-plane identities (`aksService`, `hcpService`, `acsService`, `readinessChecker`, node and
`kube-system`/`elastic-system` service accounts) and automation-tool user agents (Azure Arc, Helm, Terraform,
`OpenAPI-Generator`) are excluded; `kubectl` is never excluded by user agent alone, since both admins and attackers
with a stolen token typically drive activity through it.
### Possible investigation steps
- Review `Esql.username`, `Esql.user_agent`, and `Esql.source_ip_values` for the acting identity and client
fingerprint, confirm which cluster was targeted via `azure.resource.id`, bound the window with
`Esql.earliest_timestamp`/`Esql.latest_timestamp`, and pivot into raw `kube-audit` logs for call ordering.
Unexpected `kubectl` or custom user agents (for example `kubectl-recon`) from human-style identities, or the same
identity spanning multiple user agents/source IPs, warrant closer review.
- Check `Esql.enumerated_resources`/`Esql.enumerated_namespaces` against a known job, GitOps sync, or CI/CD pipeline.
Both cluster-scoped kinds (nodes, clusterroles, clusterrolebindings) and an all-namespaces list of a
namespace-scoped kind (for example `kubectl get pods -A`) surface as `(cluster-scoped)`; the latter is a broader
enumeration than a single-namespace query.
- Correlate with follow-on activity from the same identity/source IP: secret reads, `SelfSubjectAccessReview`
checks, pod exec, RBAC changes, and cross-reference the public address in `Esql.source_ip_values` (ignoring
the `172.31.x.x` AKS control-plane proxy entries) against expected CI/CD or administrator egress ranges.
### False positive analysis
- Controllers/operators (GitOps, backup, service-mesh, autoscalers) and CI/CD or bootstrap tooling can legitimately
span several resource types, or provision namespaces/roles/service accounts together, in one window; validate the
service account and correlate with change/deploy windows before treating as suspicious.
- Helm, Terraform, and Azure Arc user agents are pre-filtered as the dominant automation noise source, and
`elastic-system` namespace activity is excluded from the cardinality count; add newly validated automation
identities/user agents to the exclusion list to reduce further noise.
- User agents are client-supplied and spoofable, so the exclusions narrow noise but aren't strong identity
verification; corroborate with the acting identity and RBAC before dismissing an alert.
### Response and remediation
- If unauthorized, revoke or rotate the implicated credentials/tokens, tighten RBAC bindings for the identity, and
inspect for follow-on data access or privilege escalation.
- Collect the relevant `kube-audit` events and AKS diagnostic logs for the identity, source IP, and time window for
incident response.
- If the identity is a compromised service account, rotate its token/certificate and review any workloads that mount it.
"""
references = ["https://microsoft.github.io/Threat-Matrix-for-Kubernetes/"]
risk_score = 47
rule_id = "86bdaa43-9268-436f-b944-d9c64a68def3"
setup = """The Azure Fleet integration collecting AKS diagnostic logs with the `kube-audit` category forwarded through Event Hub
into the `azure.platformlogs` data stream is required for this rule.
"""
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Kubernetes",
"Data Source: Azure",
"Data Source: Azure Platform Logs",
"Data Source: Kubernetes",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Resources: Investigation Guide",
"Rule Type: ES|QL",
"Platform: Azure",
"Platform: Kubernetes",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-azure.platformlogs-* metadata _id, _index, _version
| where data_stream.dataset == "azure.platformlogs"
and event.action == "Microsoft.ContainerService/managedClusters/diagnosticLogs/Read"
and azure.platformlogs.category == "kube-audit"
| eval Esql.stage = field_extract(azure.platformlogs.properties, "log.stage"),
Esql.verb = field_extract(azure.platformlogs.properties, "log.verb"),
Esql.resource = field_extract(azure.platformlogs.properties, "log.objectRef.resource"),
Esql.namespace = field_extract(azure.platformlogs.properties, "log.objectRef.namespace"),
Esql.username = field_extract(azure.platformlogs.properties, "log.user.username"),
Esql.user_agent = field_extract(azure.platformlogs.properties, "log.userAgent"),
Esql.source_ips = field_extract(azure.platformlogs.properties, "log.sourceIPs")
| where Esql.stage == "ResponseComplete"
and Esql.verb in ("list", "get")
and Esql.resource in ("namespaces", "nodes", "pods", "roles", "clusterroles", "configmaps", "serviceaccounts", "rolebindings", "clusterrolebindings")
and Esql.username is not null
and (Esql.namespace is null or Esql.namespace != "elastic-system")
and not Esql.username rlike "system:node:.*|system:serviceaccount:kube-system:.*|system:serviceaccount:elastic-system:.*"
and not Esql.username in ("aksService", "hcpService", "readinessChecker", "acsService", "system:apiserver", "system:kube-controller-manager", "system:kube-scheduler")
and not Esql.user_agent rlike """(resourcesyncoperator|identityOperator|telegraf|clustermetadatasync|ConfigurationAgent|manager|extensionmanager)/.*\(linux/amd64\) kubernetes/\$Format|Helm/.*|.*Terraform.*|OpenAPI-Generator/.*"""
| eval Esql.namespace = coalesce(Esql.namespace, "(cluster-scoped)")
| stats
Esql.unique_resources = count_distinct(Esql.resource),
Esql.enumerated_resources = values(Esql.resource),
Esql.enumerated_namespaces = values(Esql.namespace),
Esql.source_ip_values = values(Esql.source_ips),
Esql.username_values = values(Esql.username),
Esql.event_count = count(*),
Esql.earliest_timestamp = min(@timestamp),
Esql.latest_timestamp = max(@timestamp)
by Esql.username, Esql.user_agent, azure.resource.id
| where Esql.unique_resources >= 3
| keep Esql.*, azure.resource.id
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1613"
name = "Container and Resource Discovery"
reference = "https://attack.mitre.org/techniques/T1613/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[rule.alert_suppression]
group_by = ["Esql.username", "Esql.user_agent", "azure.resource.id"]
missing_fields_strategy = "suppress"
[rule.alert_suppression.duration]
unit = "m"
value = 30