Microsoft Foundry High Request and Token Volume

Detects one caller IP sending a high number of requests and consuming a high number of tokens against the same Foundry deployment and operation during the rule lookback. That rate fits a script or a stolen key burning quota. The rule uses RequestResponse logs and does not need the prompt text. Tune the request count and token sum in the query.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2026/10/01"
  3integration = ["azure_ai_foundry"]
  4maturity = "production"
  5min_stack_version = "9.4.0"
  6min_stack_comments = "The Microsoft Foundry integration is compatible with 9.3 and above."
  7updated_date = "2026/11/03"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Detects one caller IP sending a high number of requests and consuming a high number of tokens against the same
 13Foundry deployment and operation during the rule lookback. That rate fits a script or a stolen key burning quota.
 14The rule uses RequestResponse logs and does not need the prompt text. Tune the request count and token sum in the
 15query.
 16"""
 17false_positives = [
 18    """
 19    Approved batch jobs, evaluation harnesses, and user-facing apps that fan out from one NAT. Exclude that caller IP
 20    prefix and deployment, or raise the thresholds to sit above the normal 9-minute peak.
 21    """,
 22    """
 23    Foundry masks the last octet of caller_ip_address, so unrelated users behind the same network prefix are counted
 24    together.
 25    """,
 26]
 27from = "now-9m"
 28language = "esql"
 29license = "Elastic License v2"
 30name = "Microsoft Foundry High Request and Token Volume"
 31note = """## Triage and analysis
 32
 33### Investigating Microsoft Foundry High Request and Token Volume
 34
 35One masked caller IP exceeded the request count and combined token sum in the query, on one deployment and
 36operation during the rule lookback. RequestResponse logs carry the counts and the caller prefix. They do not carry
 37the prompt.
 38
 39On a quiet deployment, manual testing stays under this line. A scripted burst, such as repeated short chats from one
 40client, crosses it.
 41
 42#### Possible investigation steps
 43
 44- Compare request count with prompt and completion token sums. Many calls and modest tokens fit a loop. Few calls and
 45  a large token sum is a different pattern and will not match this rule.
 46- Check result_signature for 429s. Rate-limit errors alongside the burst fit quota exhaustion.
 47- See whether this caller prefix and deployment are new. A first-seen prefix with this volume fits a stolen key.
 48- If API Management GatewayLogs exist for the same time, pivot on the caller prefix for full source.ip and prompts.
 49  This rule does not require those logs.
 50
 51### False positive analysis
 52
 53- Known automation and a shared egress prefix. Raise the thresholds or exclude that caller prefix and deployment.
 54- The zero-token duplicate RequestResponse event is already excluded by the caller IP and prompt_tokens filters.
 55
 56### Response and remediation
 57
 58- Rotate the Foundry key if the caller prefix is not an approved application.
 59- Apply a lower rate limit or quota on the deployment until the caller is identified.
 60- Review token spend for that deployment over the surrounding hour.
 61"""
 62references = [
 63    "https://www.elastic.co/docs/reference/integrations/azure_ai_foundry",
 64    "https://learn.microsoft.com/en-us/azure/ai-foundry/openai/how-to/monitor-openai",
 65]
 66risk_score = 47
 67rule_id = "bb2bc0e2-bc6f-4f6b-a6cc-7deb99fe2588"
 68setup = """## Setup
 69
 70This rule needs the Microsoft Foundry integration collecting the RequestResponse diagnostic category. Prompt and
 71response bodies are not required.
 72
 73- Send the RequestResponse category from the Foundry resource to the Event Hub the integration reads.
 74- Keep calls that have caller_ip_address and prompt_tokens greater than zero. Foundry also emits a zero-token twin of
 75  each call, and counting those doubles the volume.
 76
 77https://www.elastic.co/docs/reference/integrations/azure_ai_foundry
 78"""
 79severity = "medium"
 80tags = [
 81    "Data Source: Microsoft Foundry",
 82    "Use Case: Threat Detection",
 83    "Mitre Atlas: AML.T0029",
 84    "Resources: Investigation Guide",
 85    "Tactic: Impact",
 86    "Rule Type: ES|QL",
 87    "Platform: Azure",
 88    "Domain: Cloud",
 89    "Domain: GenAI",
 90    "Service: Azure AI Foundry",
 91]
 92timestamp_override = "event.ingested"
 93type = "esql"
 94
 95query = '''
 96from logs-azure_ai_foundry.logs-*
 97| where
 98    data_stream.dataset == "azure_ai_foundry.logs" and
 99    azure.ai_foundry.category == "RequestResponse" and
100    azure.ai_foundry.caller_ip_address is not null and
101    azure.ai_foundry.properties.prompt_tokens > 0
102| stats
103    Esql.event_count = count(*),
104    Esql.azure_ai_foundry_properties_prompt_tokens_sum = sum(azure.ai_foundry.properties.prompt_tokens),
105    Esql.azure_ai_foundry_properties_completion_tokens_sum = sum(azure.ai_foundry.properties.completion_tokens),
106    Esql.azure_ai_foundry_result_signature_failed_count = count(*) where azure.ai_foundry.result_signature != "200",
107    Esql.timestamp_first_seen = min(@timestamp),
108    Esql.timestamp_last_seen = max(@timestamp)
109  by
110    azure.ai_foundry.caller_ip_address,
111    azure.ai_foundry.properties.model_deployment_name,
112    azure.ai_foundry.operation_name,
113    azure.resource.name,
114    azure.resource.group
115| eval Esql.total_tokens_sum = Esql.azure_ai_foundry_properties_prompt_tokens_sum + Esql.azure_ai_foundry_properties_completion_tokens_sum
116| where Esql.event_count >= 100 and Esql.total_tokens_sum >= 10000
117| keep
118    azure.ai_foundry.caller_ip_address,
119    azure.ai_foundry.properties.model_deployment_name,
120    azure.ai_foundry.operation_name,
121    azure.resource.name,
122    azure.resource.group,
123    Esql.*
124'''
125
126
127[[rule.threat]]
128framework = "MITRE ATT&CK"
129[[rule.threat.technique]]
130id = "T1496"
131name = "Resource Hijacking"
132reference = "https://attack.mitre.org/techniques/T1496/"
133
134
135[rule.threat.tactic]
136id = "TA0040"
137name = "Impact"
138reference = "https://attack.mitre.org/tactics/TA0040/"
139
140[[rule.threat_mappings]]
141framework = "MITRE ATLAS"
142version = "2026.08"
143[[rule.threat_mappings.threat]]
144framework = "MITRE ATLAS"
145[[rule.threat_mappings.threat.technique]]
146id = "AML.T0029"
147name = "Denial of AI Service"
148reference = "https://atlas.mitre.org/techniques/AML.T0029/"
149
150
151[rule.threat_mappings.threat.tactic]
152id = "AML.TA0011"
153name = "Impact"
154reference = "https://atlas.mitre.org/tactics/AML.TA0011/"
155
156[rule.alert_suppression]
157group_by = [
158    "azure.ai_foundry.caller_ip_address",
159    "azure.ai_foundry.properties.model_deployment_name",
160    "azure.ai_foundry.operation_name",
161]
162duration = {value = 1, unit = "h"}
163missing_fields_strategy = "suppress"
164
165[rule.investigation_fields]
166field_names = [
167    "azure.ai_foundry.caller_ip_address",
168    "azure.ai_foundry.properties.model_deployment_name",
169    "azure.ai_foundry.operation_name",
170    "azure.resource.name",
171    "azure.resource.group",
172    "Esql.event_count",
173    "Esql.azure_ai_foundry_properties_prompt_tokens_sum",
174    "Esql.azure_ai_foundry_properties_completion_tokens_sum",
175    "Esql.total_tokens_sum",
176    "Esql.azure_ai_foundry_result_signature_failed_count",
177    "Esql.timestamp_first_seen",
178    "Esql.timestamp_last_seen",
179]

Triage and analysis

Investigating Microsoft Foundry High Request and Token Volume

One masked caller IP exceeded the request count and combined token sum in the query, on one deployment and operation during the rule lookback. RequestResponse logs carry the counts and the caller prefix. They do not carry the prompt.

On a quiet deployment, manual testing stays under this line. A scripted burst, such as repeated short chats from one client, crosses it.

Possible investigation steps

  • Compare request count with prompt and completion token sums. Many calls and modest tokens fit a loop. Few calls and a large token sum is a different pattern and will not match this rule.
  • Check result_signature for 429s. Rate-limit errors alongside the burst fit quota exhaustion.
  • See whether this caller prefix and deployment are new. A first-seen prefix with this volume fits a stolen key.
  • If API Management GatewayLogs exist for the same time, pivot on the caller prefix for full source.ip and prompts. This rule does not require those logs.

False positive analysis

  • Known automation and a shared egress prefix. Raise the thresholds or exclude that caller prefix and deployment.
  • The zero-token duplicate RequestResponse event is already excluded by the caller IP and prompt_tokens filters.

Response and remediation

  • Rotate the Foundry key if the caller prefix is not an approved application.
  • Apply a lower rate limit or quota on the deployment until the caller is identified.
  • Review token spend for that deployment over the surrounding hour.

References

Related rules

to-top