← Sentinel query library

Data access · Microsoft Sentinel

Investigate sensitive Key Vault operations and access context

Group secret retrieval, cryptographic use, backup and destructive operations with HTTP outcomes, identity hints and affected-object evidence.

Before you run

Data & scope

Required tables
AZKVAuditLogs
Time window
24 hours; 15-minute activity groups
  • Key Vault AuditEvent diagnostic logs routed in resource-specific mode to AZKVAuditLogs in this workspace.
  • Query access to the vault logs and 24 hours of retained coverage; 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.

Kusto Query Language
Download .kql
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
AZKVAuditLogs
| where TimeGenerated >= ago(1d) and TimeGenerated <= now()
| where OperationName in~ (
    "SecretGet", "SecretBackup", "SecretDelete", "SecretPurge",
    "KeyDecrypt", "KeyUnwrap", "KeyBackup", "KeyDelete", "KeyPurge",
    "CertificateBackup", "CertificateDelete", "CertificatePurge")
| extend CallerObjectId = coalesce(tostring(Identity.claim.oid),
        tostring(Identity.claim["http://schemas.microsoft.com/identity/claims/objectidentifier"])),
    ClientAppId = tostring(Identity.claim.appid),
    VaultResource = _ResourceId,
    Successful = HttpStatusCode between (200 .. 299)
| summarize ObservedRequests = count(), SuccessfulRequests = countif(Successful),
    DeniedRequests = countif(HttpStatusCode in (401, 403)),
    OtherStatusRequests = countif(isnull(HttpStatusCode)
        or (not(Successful) and HttpStatusCode !in (401, 403))),
    ObjectEstimate = dcount(iff(isnotempty(Id), pack_array(Id), dynamic(null))),
    SampleObjects = make_set(Id, 5), HttpStatuses = make_set(HttpStatusCode, 10),
    NetworkContexts = make_set(AddressAuthorizationType, 5),
    AssignmentEvidence = make_set(AppliedAssignmentId, 3),
    IdentityEvidence = make_set(Identity, 3),
    CorrelationSamples = make_set(CorrelationId, 3),
    FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
    by WindowStart = bin(TimeGenerated, 15m), VaultResource, OperationName,
        CallerObjectId, ClientAppId, CallerIpAddress
| extend ReviewPriority = case(OperationName endswith "Purge", 3,
        OperationName endswith "Delete" or OperationName endswith "Backup", 2, 1),
    PrincipalIdPresent = isnotempty(CallerObjectId)
| project WindowStart, FirstSeen, LastSeen, VaultResource, OperationName,
    ReviewPriority, CallerObjectId, ClientAppId, CallerIpAddress, PrincipalIdPresent,
    ObservedRequests, SuccessfulRequests, DeniedRequests, OtherStatusRequests,
    ObjectEstimate, SampleObjects, HttpStatuses, NetworkContexts,
    AssignmentEvidence, IdentityEvidence, CorrelationSamples
| order by ReviewPriority desc, SuccessfulRequests desc, LastSeen desc
| take 200

Read-only query. Run in your own authorized workspace after checking prerequisites.

Use this hunt to examine access to secrets and cryptographic operations alongside backup and destructive activity. It groups selected Key Vault operations into 15-minute windows while preserving successful, denied and other HTTP outcomes. The ordering brings purge, deletion and backup activity ahead of routine retrieval, but the priority values are triage choices rather than Microsoft severity classifications.

The operation list is deliberate. SecretGet retrieves a secret, while operations such as KeyDecrypt and KeyUnwrap use a key to perform cryptographic work. A KeyGet event is not equivalent to exporting a private key and is not selected here. Backup activity also needs context; a backup event alone does not establish extraction of plaintext material. Key Vault operation reference.

Interpret identity, outcome and scope

The query reads the documented dynamic Identity field and attempts common object-ID and application-ID claims. Those are identity hints, not a promise that every event has the same claim layout. Missing identifiers remain visible, and a small sample of the original identity objects supports inspection. A user acting through an application and a standalone application are not interchangeable actors.

HTTP 2xx responses count as successful requests. A 401 or 403 contributes to denied requests; other statuses are kept separately. Failure is not proof that a secret was read, and success is not proof that the resulting data was misused. Inspect status samples and the raw event when a grouped result is ambiguous. Resource-specific audit schema.

The affected-object estimate excludes blank IDs. It is approximate, and an ID can identify a version rather than a logical secret or key. The five object samples are investigation pointers, not the complete object list. Network authorization context and applied-assignment samples help explain how access was evaluated; they do not calculate the caller’s complete effective permissions.

Investigate the operation in context

Resolve the caller and client application to a workload owner, then check whether the selected operation belongs to its expected function. Compare the vault, object, time and network source with deployment records, backup jobs, certificate operations and incident-response work.

For unexpected retrieval or cryptographic use, inspect the caller’s sign-ins and workload activity around the returned correlation samples. For destructive operations, confirm the actual resource outcome and recovery options through the service’s authoritative state. Avoid testing recovery by making additional destructive changes during investigation.

An application restart, cache expiration, scale-out event or planned rotation can produce a large burst of legitimate requests. Backup and renewal automation can also appear unusual after a long quiet interval. Tune by the combination of identity, vault and operation, with an accountable owner and review date for exceptions.

Coverage and validation

This recipe expects AZKVAuditLogs; a workspace containing only the older AzureDiagnostics representation needs a separate adaptation. Confirm the logging destination and a known benign operation before interpreting silence. Key Vault logging covers several request and failure cases, but enabling a setting now does not reconstruct uncollected history. Logging configuration.

The query scans 24 hours and returns at most 200 groups. Narrow by vault or time for complete review of a busy interval. It is read-only and documentation-checked, with no live-tenant execution or validated misuse-detection claim. Validate successful retrieval and a harmless denied request in an authorized environment; do not generate a purge merely to test this hunt.

Verify the source

Microsoft references

  1. Microsoft Learn — AZKVAuditLogs table schema ↗
  2. Microsoft Learn — Key Vault logging and operation names ↗
  3. Microsoft Learn — Enable Key Vault logging ↗
  4. Microsoft Learn — Kusto dcount aggregation ↗
Before turning a hunt into an alert

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 →