Entra ID Primary Refresh Token Used by a Command-Line Client

Last updated 5 days ago on 2026-11-19
Created 5 days ago on 2026-11-19

About

Identifies a Microsoft Entra ID sign-in that presents a Primary Refresh Token (PRT) from a first-party command-line or scripting client, such as Azure CLI, Azure PowerShell, Microsoft Graph PowerShell, Azure AD PowerShell, Exchange Online PowerShell, Teams PowerShell, SharePoint Online Management Shell, or Intune PowerShell. PRTs are normally redeemed by device-integrated components such as Windows sign-in, Microsoft Edge, Office, OneDrive, and the Microsoft Authentication Broker. A PRT presented through a CLI client may indicate PRT replay: an adversary with a registered device and a device-bound PRT (tools such as ROADtools enable this) can mint tokens for Microsoft Graph and other resources without interactive prompts.
Tags
Domain: CloudDomain: IdentityData Source: AzureData Source: Microsoft Entra IDData Source: Microsoft Entra ID Sign-In LogsUse Case: Identity and Access AuditUse Case: Threat DetectionTactic: Defense EvasionTactic: Credential AccessProfile: BetaRule Type: Custom Query (KQL)Platform: Entra IDLanguage: kuery
Severity
medium
Risk Score
47
MITRE ATT&CK™

Credential Access (TA0006)(external, opens in a new tab or window)

Defense Evasion (TA0005)(external, opens in a new tab or window)

False Positive Examples
Authorized red team or penetration testing engagements that replay PRTs. Document the engagement and add exceptions on the calling user or source IP. Administrators using CLI clients on Entra joined or registered devices where the Web Account Manager (WAM) broker redeems the PRT on the client's behalf. Azure CLI and Azure PowerShell with broker authentication enabled are common examples. Validate the user, device, and source before tuning.
License
Elastic License v2(external, opens in a new tab or window)

Definition

Rule Type
Query (Kibana Query Language)
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-azure.signinlogs-*
Related Integrations

azure(external, opens in a new tab or window)

Query
text code block:
data_stream.dataset: "azure.signinlogs" and azure.signinlogs.properties.incoming_token_type: "primaryRefreshToken" and azure.signinlogs.properties.app_id: ( "04b07795-8ddb-461a-bbee-02f9e1bf7b46" or "1950a258-227b-4e31-a9cf-717495945fc2" or "14d82eec-204b-4c2f-b7e8-296a70dab67e" or "1b730954-1685-4b74-9bfd-dac224a7b894" or "fb78d390-0c51-40cd-8e17-fdbfab77341b" or "12128f48-ec9e-42f0-b203-ea49fb6af367" or "9bc3ab49-b65d-410a-85ad-de819febfddc" or "d1ddf0e4-d672-4dae-b554-9d5bdfd93547" ) and event.outcome: "success"

Install detection rules in Elastic Security

Detect Entra ID Primary Refresh Token Used by a Command-Line Client in the Elastic Security detection engine by installing this rule into your Elastic Stack.

To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).