Azure Key Vault Certificate Accessed


Description

Detects when Azure Key Vault certificates are accessed via read operations. Adversaries may attempt to dump certificates to extract credentials for service principals or establish persistence through certificate-based authentication.

Query · python

from panther_azureactivity_helpers import (
    azure_activity_alert_context,
    azure_activity_success,
    extract_resource_name_from_id,
)

CERTIFICATE_READ = "MICROSOFT.KEYVAULT/VAULTS/CERTIFICATES/READ"


def rule(event):
    operation = event.get("operationName", "").upper()
    return operation == CERTIFICATE_READ and azure_activity_success(event)


def title(event):
    resource_id = event.get("resourceId", "")
    keyvault_name = extract_resource_name_from_id(resource_id, "vaults", default="UNKNOWN")

    caller = event.get("callerIpAddress", default="<UNKNOWN_CALLER>")

    return f"Azure Key Vault certificate accessed from [{keyvault_name}] by [{caller}]"


def alert_context(event):
    context = azure_activity_alert_context(event)

    resource_id = event.get("resourceId", "")

    keyvault_name = extract_resource_name_from_id(resource_id, "vaults", default="")
    if keyvault_name:
        context["keyvault_name"] = keyvault_name

    certificate_name = extract_resource_name_from_id(resource_id, "certificates", default="")
    if certificate_name:
        context["certificate_name"] = certificate_name

    return context

Analyst notes

  1. Find all Key Vault certificate and secret operations by the callerIpAddress in the 6 hours before and after this alert to identify patterns of bulk credential access
  2. Query for the certificate details to determine which service principals or applications use this certificate for authentication
  3. Check if the identity accessing the certificate has a history of Key Vault access in the past 30 days to determine if this is normal behavior
Raw source Azure Key Vault Certificate Accessed · Panther Python
Esc
Published by panther-labs/panther-analysis ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
AnalysisType: rule
Filename: azure_keyvault_certificate_accessed.py
RuleID: "Azure.MonitorActivity.KeyVault.CertificateAccessed"
DisplayName: "Azure Key Vault Certificate Accessed"
Enabled: true
LogTypes:
  - Azure.MonitorActivity
Severity: Info
Description: >
  Detects when Azure Key Vault certificates are accessed via read operations.
  Adversaries may attempt to dump certificates to extract credentials for service
  principals or establish persistence through certificate-based authentication.
Reports:
  MITRE ATT&CK:
    - TA0006:T1555 # Credential Access: Credentials from Password Stores
    - TA0009:T1530 # Collection: Data from Cloud Storage
Tags:
  - AZT604
  - AZT604.2
  - Credential Access
  - Collection
  - Credentials from Password Stores
  - Data from Cloud Storage
Runbook: |
  1. Find all Key Vault certificate and secret operations by the callerIpAddress in the 6 hours before and after this alert to identify patterns of bulk credential access
  2. Query for the certificate details to determine which service principals or applications use this certificate for authentication
  3. Check if the identity accessing the certificate has a history of Key Vault access in the past 30 days to determine if this is normal behavior
Reference: https://microsoft.github.io/Azure-Threat-Research-Matrix/CredentialAccess/AZT604/AZT604-2
SummaryAttributes:
  - resourceId
  - callerIpAddress
  - correlationId
Tests:
  - Name: Certificate Accessed Successfully
    ExpectedResult: true
    Log:
      {
        "time": "2025-12-23T10:30:00.0000000Z",
        "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myresourcegroup/providers/Microsoft.KeyVault/vaults/myvault/certificates/app-service-cert",
        "operationName": "Microsoft.KeyVault/vaults/certificates/read",
        "operationVersion": "7.0",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "1.1.1.1",
        "location": "eastus",
        "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "identity": {
          "claims": {
            "appid": "12345678-1234-1234-1234-123456789abc"
          }
        },
        "tenantId": "87654321-4321-4321-4321-111111111111"
      }
  - Name: Certificate Read with Succeeded Status
    ExpectedResult: true
    Log:
      {
        "time": "2025-12-23T11:00:00.0000000Z",
        "resourceId": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/prod-rg/providers/Microsoft.KeyVault/vaults/prodvault/certificates/service-principal-cert",
        "operationName": "Microsoft.KeyVault/vaults/certificates/read",
        "operationVersion": "7.0",
        "category": "Administrative",
        "resultType": "Succeeded",
        "callerIpAddress": "2.2.2.2",
        "location": "westus",
        "correlationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "identity": {
          "claims": {
            "appid": "87654321-4321-4321-4321-123456789abc"
          }
        },
        "tenantId": "22222222-2222-2222-2222-222222222222"
      }
  - Name: Case Insensitive Match
    ExpectedResult: true
    Log:
      {
        "time": "2025-12-23T12:00:00.0000000Z",
        "resourceId": "/subscriptions/33333333-3333-3333-3333-333333333333/resourceGroups/security-rg/providers/Microsoft.KeyVault/vaults/secvault/certificates/ssl-cert",
        "operationName": "microsoft.keyvault/vaults/certificates/read",
        "operationVersion": "7.0",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "3.3.3.3",
        "location": "centralus",
        "correlationId": "c3d4e5f6-a7b8-9012-cdef-333333333333",
        "tenantId": "33333333-3333-3333-3333-333333333333"
      }
  - Name: Different Operation
    ExpectedResult: false
    Log:
      {
        "time": "2025-12-23T14:00:00.0000000Z",
        "resourceId": "/subscriptions/55555555-5555-5555-5555-555555555555/resourceGroups/myresourcegroup/providers/Microsoft.KeyVault/vaults/myvault/certificates/cert2",
        "operationName": "Microsoft.KeyVault/vaults/certificates/write",
        "operationVersion": "7.0",
        "category": "Administrative",
        "resultType": "Success",
        "callerIpAddress": "5.5.5.5",
        "location": "eastus",
        "correlationId": "e5f6a7b8-c9d0-1234-ef01-555555555555",
        "tenantId": "55555555-5555-5555-5555-555555555555"
      }

# ------ paired body: azure_keyvault_certificate_accessed.py ------

from panther_azureactivity_helpers import (
    azure_activity_alert_context,
    azure_activity_success,
    extract_resource_name_from_id,
)

CERTIFICATE_READ = "MICROSOFT.KEYVAULT/VAULTS/CERTIFICATES/READ"


def rule(event):
    operation = event.get("operationName", "").upper()
    return operation == CERTIFICATE_READ and azure_activity_success(event)


def title(event):
    resource_id = event.get("resourceId", "")
    keyvault_name = extract_resource_name_from_id(resource_id, "vaults", default="UNKNOWN")

    caller = event.get("callerIpAddress", default="<UNKNOWN_CALLER>")

    return f"Azure Key Vault certificate accessed from [{keyvault_name}] by [{caller}]"


def alert_context(event):
    context = azure_activity_alert_context(event)

    resource_id = event.get("resourceId", "")

    keyvault_name = extract_resource_name_from_id(resource_id, "vaults", default="")
    if keyvault_name:
        context["keyvault_name"] = keyvault_name

    certificate_name = extract_resource_name_from_id(resource_id, "certificates", default="")
    if certificate_name:
        context["certificate_name"] = certificate_name

    return context

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.