KQLHunting query: tune before alertingCloud AI abuse: Azure OpenAI, Vertex AI, self-hosted
Azure OpenAI data-plane requests from a caller IP not seen in the previous two weeks
Activity logs only show control-plane actions such as listKeys; once a key is stolen, the abuse happens on the data plane. With a diagnostic setting that sends the RequestResponse category to Log Analytics, each Azure OpenAI request lands in AzureDiagnostics with OperationName, CallerIPAddress, ResultSignature (the response status code) and DurationMs. This hunt lists caller addresses that sent requests to a Cognitive Services / Azure OpenAI account in the last day but not in the 13 days before, with the share of 401/403 failures: many failures suggest key guessing or a revoked key being retried, many successes from a new address suggest a leaked key in use.
- Log source
- Microsoft Sentinel / Log Analytics: AzureDiagnostics (Azure OpenAI RequestResponse resource logs)
- Techniques
- LLM10 Unbounded Consumption · AML.T0034 Cost Harvesting · AML.T0012 Valid Accounts
- MITRE ATT&CK
- T1496.004Cloud Service Hijacking
- Reviewed
- 2026-11-10
Query
let lookback = 14d;
let recent = 1d;
let aoai = AzureDiagnostics
| where ResourceProvider =~ "MICROSOFT.COGNITIVESERVICES" and Category == "RequestResponse";
let known_ips = aoai
| where TimeGenerated between (ago(lookback) .. ago(recent))
| distinct CallerIPAddress;
aoai
| where TimeGenerated > ago(recent)
| where CallerIPAddress !in (known_ips)
| summarize Requests = count(), AuthFailures = countif(ResultSignature in ("401", "403")),
Operations = make_set(OperationName, 20), Accounts = make_set(_ResourceId, 20),
FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
by CallerIPAddress
| extend AuthFailureRatio = round(todouble(AuthFailures) / Requests, 2)
| order by Requests desc Expected false positives
- New application hosts, scale-out or changed egress addresses (NAT gateways, App Service outbound IPs)
- Developers testing from home or travel networks with a shared key
- Azure may mask part of CallerIPAddress in these logs; if so, the hunt works on the masked prefix and is coarser
Sources
- Azure OpenAI monitoring data reference (resource log categories: Audit, RequestResponse, Trace)
- Monitor Azure OpenAI (AzureDiagnostics columns and sample queries)
- Azure Monitor: AzureDiagnostics table reference
- Microsoft: Disrupting a global cybercrime network abusing generative AI (Storm-2139, Feb 2025)
Reviewed against vendor documentation, not tested in your environment. Defensive use only.