Before you run
Data & scope
- Required tables
- Time window
- 24 hours; 15-minute groups with at least 10 denied requests
- Key Vault AuditEvent diagnostic logs routed in resource-specific mode to AZKVAuditLogs in this workspace.
- Query access and 24 hours of retained vault telemetry; AzureDiagnostics alone does not populate this table.
Documentation review by Codex (AI). No live-tenant execution or detection-performance claim. Validate schema, data coverage and expected results in your workspace.
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
AZKVAuditLogs
| where TimeGenerated >= ago(1d) and TimeGenerated <= now()
| where HttpStatusCode in (401, 403)
| extend CallerObjectId = coalesce(tostring(Identity.claim.oid),
tostring(Identity.claim["http://schemas.microsoft.com/identity/claims/objectidentifier"])),
ClientAppId = tostring(Identity.claim.appid)
| summarize DeniedRequests = count(),
Statuses = make_set(HttpStatusCode, 3),
NetworkContexts = make_set(AddressAuthorizationType, 5),
AssignmentSamples = make_set(AppliedAssignmentId, 3),
ResultSamples = make_set(ResultType, 5),
CorrelationSamples = make_set(CorrelationId, 5),
FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
by WindowStart = bin(TimeGenerated, 15m), VaultResource = _ResourceId,
OperationName, CallerObjectId, ClientAppId, CallerIpAddress
| where DeniedRequests >= 10
| extend IdentityState = iff(isempty(CallerObjectId), "Object ID unavailable", "Object ID observed")
| order by DeniedRequests desc, LastSeen desc
| take 200
Read-only query. Run in your own authorized workspace after checking prerequisites.
Use this hunt when a workload repeatedly fails to reach a Key Vault operation or when investigating an unexpected source attempting access. It groups recorded HTTP 401 and 403 responses over 15-minute windows and returns groups containing at least ten requests. That threshold is an analyst-selected starting point, not a Microsoft attack classification.
Separate denial from compromise
The selected requests did not return a 2xx success outcome. Their presence does not show that a secret was disclosed. A 403 can reflect authorization or network conditions, while a 401 can involve authentication. Inspect the operation, response and service context before choosing a remediation. The resource-specific schema provides the outcome and authorization-context fields used here.
The query attempts common object-ID and application-ID claims from the dynamic Identity object. Missing object IDs are explicitly labelled. A blank ID is not an anonymous human, and an application ID is not automatically the tenant-local service-principal object ID. Preserve those distinctions when pivoting to identity logs.
CallerIpAddress and the operation remain grouping keys so one failing application action does not merge silently with another. Retries can inflate counts. A group is therefore a request burst, not ten independent intrusion attempts or ten different secrets.
Investigate the failing dependency
Identify the application owner and compare the burst with a release, identity rotation, role change, network migration or cache restart. Check whether the workload selected the intended identity and vault. For a production outage, compare the first failure with the last known successful request.
Review network-context and applied-assignment samples where populated, then inspect the underlying records. The small arrays are evidence pointers rather than complete permission evaluations. Correlate with current network and authorization configuration independently; a log field does not replace authoritative configuration.
If malicious activity remains plausible, inspect nearby successful operations and the initiating workload’s authentication history. Keep the hypothesis separate from the recorded denial outcome. Key Vault audit coverage.
Tune and validate
Expected retry storms, expired credentials and rollout mistakes can all produce this pattern. Set thresholds per application and vault after observing normal behavior. Avoid suppressing an entire vault because one client is noisy.
Validate a harmless denied request in an authorized environment and confirm how the identity fields appear. Use existing logs to test threshold boundaries without deliberately hammering the service. This 24-hour hunt returns up to 200 groups; shorter bursts crossing bin boundaries may be split. It is documentation-checked, not tenant-tested, and does not measure all failed network connections or prove compromise.
Verify the source
Microsoft references
Measure normal activity, validate known test cases, account for ingestion delays, choose a threshold and entity mapping, and assign an owner. Results require investigation.
Follow the detection learning path →