Free plan available. Set up in minutes with the collectors you already use. Start free
Logthread

Guide

Azure role assignments and Key Vault

Logthread reads who was given or lost an Azure role, and every read, change, delete and purge of a Key Vault secret, key or certificate, from your Azure subscription. It turns them into security fields and offers detections for them: privileged roles assigned, role assignments removed, many secrets read by one identity, secrets deleted or purged, and vault access changed.

This is a beta feature. It works with any Azure subscription you stream to Logthread with the Microsoft Azure integration.

How it works#

  1. The subscription's activity log records every role assignment (MICROSOFT.AUTHORIZATION/ROLEASSIGNMENTS/WRITE and /DELETE). Each Key Vault writes its own audit log (category AuditEvent).
  2. Diagnostic settings stream both to one Azure Event Hub in your subscription.
  3. The Logthread Agent, on a Linux machine that reaches the hub, reads it and sends the records over outbound HTTPS. They arrive as service azure.
  4. The Azure role assignments and Key Vault parser turns them into fields such as event.action, user.name, azure.role.name and azure.keyvault.name.
  5. The Azure detections read those fields.

Nothing connects into your Azure account: Logthread never signs in to it. The agent's only Azure credential is a Listen-only key for the hub.

What you need#

  • The Azure CLI, signed in (az login) to the subscription.
  • To create the Event Hub: Contributor on its resource group.
  • To create the diagnostic settings: Monitoring Contributor (or any role with Microsoft.Insights/diagnosticSettings/write) on the subscription and on each Key Vault.
  • A Linux machine that can reach the Event Hub namespace on port 5671, for the agent.

Set it up#

Open Integrations → Microsoft Azure and answer the questions (the defaults are fine). The connection page then gives you each command with your answers and the integration's ingest key filled in. The steps are:

  1. Create an Event Hub. One namespace and hub collect every log you stream. The last command prints the Listen-only connection string the agent needs.
  2. Stream logs to the hub. A diagnostic setting on the subscription sends the activity log (categories Administrative, Security, Alert and Policy). Role assignments are in Administrative.
  3. Stream the Key Vault audit logs. One diagnostic setting, logthread-audit, with category AuditEvent on every vault of the subscription, to the same hub:

``sh for KV in $(az keyvault list --query "[].id" -o tsv); do az monitor diagnostic-settings create --name logthread-audit --resource "$KV" \ --event-hub logs --event-hub-rule $RULE --logs '[{"category":"AuditEvent","enabled":true}]' done ``

$RULE is the namespace's authorization rule from step 2. A diagnostic setting can only send to an Event Hub in the vault's own region: for vaults in another region, create a hub there and repeat this step. A vault created later needs the same setting.

  1. Install the Logthread Agent with the command shown. It asks for the connection string from step 1 and keeps it in a file only root can read.
  2. Check what arrives. The connection page counts azure.category values from the last 24 hours: Administrative (with any change in the subscription, such as assigning a role) and AuditEvent (with the first read of a secret, key or certificate).
  3. Turn on the parser. Under Then add, choose Use parser: Azure role assignments and Key Vault. It previews the parser on your own records, then activates it. The check on the connection page then counts the parsed event.action values. The parser is also in Pipelines → Library, under Security.

What working looks like: the connection page shows the integration Active, both categories counted, and parsed actions such as role_assignment_created and secret_read. In Explore:

service:azure azure.keyvault.name:* | stats count() by event.action, user.name

The fields#

The parser reads only role assignment writes and deletes, Key Vault access policy writes, and Key Vault AuditEvent records. Every other Azure record is left unchanged. It changes nothing already stored.

FieldValue
event.actionRoles: role_assignment_created, role_assignment_deleted, access_policy_changed. Key Vault: secret_read, secret_listed, secret_set, secret_updated, secret_deleted, secret_purged, secret_backed_up, secret_restored, secret_recovered; the same for key_* (with key_used for encrypt, decrypt, sign, verify, wrap and unwrap, key_created and key_rotated) and certificate_*; vault_read, vault_changed, vault_deleted, vault_recovered. Other operations have no event.action
event.categoryiam (roles and access), configuration (the vault), database (secrets, keys and certificates)
event.outcomesuccess or failure (Key Vault: an HTTP status of 400 or more is a failure). The "started" record of a role assignment is unknown
user.nameWho acted: the user's UPN (a guest's live.com# prefix removed), else the application id, else the object id. Also kept as azure.caller.upn, azure.caller.app_id and azure.caller.object_id
source.addressThe caller's IP address
azure.role.definition_id, azure.role.nameThe role (built-in roles by name: Owner, Contributor, Reader, User Access Administrator, Role Based Access Control Administrator, and the Key Vault roles)
azure.role.privilegedtrue for Owner, Contributor, User Access Administrator and Role Based Access Control Administrator
azure.principal.id, azure.principal.type, user.target.nameWho was given or lost the role (Azure logs the object id, not a name)
azure.scope, azure.scope.levelWhere: root, management_group, subscription, resource_group or resource
azure.keyvault.nameThe vault (also for a role assigned on a vault)
azure.keyvault.object.type, azure.keyvault.object.namesecret, key or certificate, and its name. Never its value: Key Vault does not log values
observer.vendor, observer.product, cloud.providerMicrosoft; Azure Activity Log or Azure Key Vault; azure

Severity: purges are errors; deletes, access changes, a privileged role assigned and refused requests are warnings; everything else is info.

Some searches to start from:

service:azure event.action:role_assignment_created azure.role.privileged:true
service:azure event.action:(role_assignment_created OR role_assignment_deleted) | stats count() by azure.role.name, azure.scope.level
azure.keyvault.name:* event.outcome:failure | stats count() by user.name, source.address

Detections#

Open Security → SIEM and search azure, or use Turn on recommended, which offers them once the data arrives.

DetectionFires on
Privileged Azure role assignedOwner, Contributor, User Access Administrator or Role Based Access Control Administrator assigned at the root, a management group or a subscription (critical)
Azure role assignment removedA role assignment deleted (info)
Many Key Vault secrets read by one identityOne identity reads 20 or more different secrets, keys or certificates in 10 minutes. It counts distinct objects, so an application re-reading its few secrets does not fire it
Key Vault secret, key or certificate deletedA secret, key or certificate deleted from a vault
Key Vault secret, key or certificate purgedA deleted object purged: it can no longer be recovered (critical)
Key Vault access changedA vault's access policy changes, or a role is assigned or removed on a vault

The integration also suggests an alert, Azure Key Vault secrets deleted or purged, under Then add. The threat report counts these detections with the others.

Ask an AI agent or Pari#

  • With MCP: list_detections with query azure lists the six detections and whether their data arrives; search_logs runs the searches above.
  • Pari answers "how do I set up Azure Key Vault logs" from this page and, when an owner has turned on data reads for her, "who was given Owner this week" from your data.

Price: what Azure role and Key Vault logs cost#

Nothing extra. The records are billed as data ingested, ₹85 ($0.90) per GB on every plan, like any other data; the parser and the detections add no charge. Key Vault writes one record per operation, so a vault an application reads often can send many records: check the volume on Administration → Usage, By service, and drop what you do not need with a pipeline. See Prices.

Troubleshooting#

  • No AuditEvent arrives. Check the setting exists on the vault (az monitor diagnostic-settings list --resource <vault id>) and that the vault and the hub are in the same region. A vault allows at most five diagnostic settings. Records arrive only once something reads the vault.
  • No Administrative records. Check the subscription setting (az monitor diagnostic-settings subscription list). Activity log records arrive a few minutes after the change.
  • azure.role.name is empty. The role is a custom role: only built-in roles are named. azure.role.definition_id is always set; find its name with az role definition list --name <id>.
  • Who got the role shows as an id. Azure logs the object id of the principal. Find the name with az ad user show --id <id>, az ad group show --group <id> or az ad sp show --id <id>.
  • Two records for each role assignment. Azure writes a "started" record and a "succeeded" one. The detections count only the succeeded one.
  • The detections never fire. Check the parser is Active on the connection page (or in Pipelines): without it, the fields do not exist.

Limits#

  • Role assignments made by Privileged Identity Management activation arrive as ordinary role assignments.
  • Managed HSM, classic administrators and deny assignments are not mapped.
  • Only built-in roles are named.

Remove it#

Delete the logthread-audit setting on each vault and the logthread setting on the subscription (az monitor diagnostic-settings delete and az monitor diagnostic-settings subscription delete), then remove the integration under Integrations, which revokes its ingest key.