OAuth & Identity Persistence · T1059.009 / T1087.004

Microsoft Graph PowerShell & App-Only Token Abuse Detection in Audit Logs

Direct Answer (Key Forensic Takeaway)

Attackers regularly import stolen tokens or authenticate via Microsoft Graph Command Line Tools (AppId 14d82eec-204b-4c2f-b7e8-296a70dab67e) or Azure CLI (04b07795-8ddb-461a-bbee-02f9e1bf7b46) to enumerate users, dump Entra groups, or read emails via Graph API—leaving ClientAppId 14d82eec and Client=REST;Client=Microsoft.Graph telemetry across Entra and Purview logs.

Detection Objective & Threat Scope

Modern cloud attackers don’t click slowly through Entra web portals once inside an employee account—they immediately automate directory reconnaissance, SharePoint enumeration, and mailbox extraction using Microsoft’s own first-party CLI applications.

Because Microsoft Graph Command Line Tools (`14d82eec-204b-4c2f-b7e8-296a70dab67e`) and Azure CLI (`04b07795-8ddb-461a-bbee-02f9e1bf7b46`) exist as trusted Microsoft first-party apps inside every tenant, attackers abuse them heavily in both Device Code phishing and post-compromise scripts—unless defenders explicitly monitor and restrict who can use them.

Look in two places when hunting CLI/API abuse: in Entra ID Sign-In JSON, inspect `appId` and `appDisplayName`; in Purview Unified Audit Logs (`MailItemsAccessed`, `FileDownloaded`), inspect `AuditData.AppAccessContext.ClientAppId` and `ClientInfoString` (`Client=REST;Client=Microsoft.Graph`).

Seeing a marketing manager, HR coordinator, or finance clerk suddenly authenticate to `Microsoft Graph Command Line Tools` or `Microsoft Azure PowerShell` is almost always an indicator of automated compromise or Device Code phish.

1. RAW TELEMETRY OAuth & Identity Persistence T1059.009 / T1087.004 2. CLIENT-SIDE PARSE AuditVane Engine Microsoft Graph PowerShell token a 0 Bytes Uploaded 3. SOC OUTCOME Scoped Containment IOCs · CSV · KQL
Local browser DFIR workflow for Microsoft Graph PowerShell token abuse Entra logs (T1059.009 / T1087.004)
AdSense-Ready In-Article Placement

Forensic Telemetry Fields & High-Signal Indicators

Telemetry Field / Pattern Meaning in M365 / Entra High-Signal Threat Indicator
14d82eec-204b-4c2f-b7e8-296a70dab67eMicrosoft Graph Command Line Tools (PowerShell)Major red flag on non-IT/non-security employees
04b07795-8ddb-461a-bbee-02f9e1bf7b46Microsoft Azure CLI (`az login`)Heavily abused in Device Code phishing & cloud recon
1950a258-227b-4e31-a9cf-717495945fc2Microsoft Azure PowerShellUsed for Entra & Azure resource enumeration
00b41c95-dab0-4487-9791-b9d2c32c80f2Office 365 Management / Exchange RESTWatch alongside unexpected REST calls
Client=REST;Client=Microsoft.GraphExchange Online access via Graph APIReveals programmatic mail access rather than Outlook
Assignment Required = YesEnterprise App setting locking CLI accessLimits Graph PowerShell solely to vetted IT/SecOps

Hunt Non-IT Graph CLI Logins & Lock Down Graph PowerShell Access

// Sentinel KQL hunt for CLI/PowerShell cloud app usage:
SigninLogs
| where AppId in ("14d82eec-204b-4c2f-b7e8-296a70dab67e","04b07795-8ddb-461a-bbee-02f9e1bf7b46","1950a258-227b-4e31-a9cf-717495945fc2")
| summarize Hits=count(), IPs=make_set(IPAddress), UAs=make_set(UserAgent) by UserPrincipalName, AppDisplayName

# PowerShell: Require explicit user assignment on Microsoft Graph Command Line Tools!
$sp = Get-MgServicePrincipal -Filter "appId eq '14d82eec-204b-4c2f-b7e8-296a70dab67e'"
Update-MgServicePrincipal -ServicePrincipalId $sp.Id -AppRoleAssignmentRequired:$true

Sample Graph CLI Detection Table

UserPrincipalName                  AppDisplayName                      Hits IPs
-----------------                  --------------                      ---- ---
marketing.mgr@contoso.invalid      Microsoft Graph Command Line Tools  12   ["185.220.101.45"]

First-Party Microsoft CLI App IDs Every SOC Should Monitor

App Display NameCanonical AppId GUIDHardening Recommendation
Microsoft Graph Command Line Tools14d82eec-204b-4c2f-b7e8-296a70dab67eSet AppRoleAssignmentRequired = True; assign vetted admins only
Microsoft Azure CLI04b07795-8ddb-461a-bbee-02f9e1bf7b46Restrict via Conditional Access or Assignment Required
Microsoft Azure PowerShell1950a258-227b-4e31-a9cf-717495945fc2Require Compliant Device + Phishing-Resistant MFA via CA

Microsoft Graph Command Line Tools Sign-In JSON Event

{
  "createdDateTime": "2026-12-03T12:10:05Z",
  "userPrincipalName": "marketing.mgr@contoso-demo.invalid",
  "appDisplayName": "Microsoft Graph Command Line Tools",
  "appId": "14d82eec-204b-4c2f-b7e8-296a70dab67e",
  "resourceDisplayName": "Microsoft Graph",
  "ipAddress": "185.220.101.45",
  "userAgent": "PowerShell/7.4.6",
  "status": { "errorCode": 0 }
}

A marketing manager authenticating to `14d82eec-204b-4c2f-b7e8-296a70dab67e` with `PowerShell/7.4.6` from `185.220.101.45` is a clear compromise—and triggers `AV-003` (`PowerShell` UA) inside AuditVane.

Real-World Incident Walkthrough

After compromising a finance analyst via Device Code phishing, an attacker connects via `Connect-MgGraph` from `185.220.101.45` and dumps the entire Global Address List (`Get-MgUser -All`), admin role memberships, and inbox emails over Graph REST API.

Dropping Entra Sign-In JSON + Purview UAL CSV into AuditVane surfaces `appId: 14d82eec-204b-4c2f-b7e8-296a70dab67e` in the ClientApp column alongside `Client=REST;Client=Microsoft.Graph` inside `MailItemsAccessed` (`AV-007`).

Step-by-Step Triage, Containment & Verification

  1. Load Entra Sign-In JSON and Purview UAL CSV exports into AuditVane and search for `14d82eec`, `04b07795`, `Graph Command Line`, or `Client=Microsoft.Graph`.
  2. Flag every sign-in from non-IT/non-DevOps accounts or external untrusted IP addresses.
  3. Revoke sessions immediately via `Revoke-MgUserSignInSession` and audit `OAuth2PermissionGrant` scopes granted to `14d82eec` on behalf of the user (standard users can inadvertently consent to `User.Read.All` inside Graph CLI unless restricted!).
  4. In Entra Enterprise Applications, locate **Microsoft Graph Command Line Tools**, **Microsoft Azure CLI**, and **Microsoft Azure PowerShell**, and set **Assignment required? = Yes** (assigning only your vetted admin security group).
  5. Layer a Conditional Access policy targeting Microsoft Admin Portals / CLI apps requiring Compliant Devices + Phishing-Resistant MFA.

How to Verify Containment Completed Cleanly

  • Microsoft Graph Command Line Tools (`14d82eec`) restricted via Assignment Required = Yes.
  • Zero non-IT employees holding historical OAuth grants under Graph PowerShell.
  • Conditional Access policy covering Azure CLI and PowerShell verified active.

Analyst Blind Spots, Licensing Quirks & False Positives

Setting "Do not allow user consent for apps" in Entra ID still may NOT stop users from authenticating to Microsoft Graph Command Line Tools with default pre-consented scopes unless **Assignment required? = Yes** is enforced on that Enterprise Application!

Don’t lock yourself out when enabling Assignment Required—explicitly assign your DevOps/IAM admin group to `14d82eec` BEFORE flipping `AppRoleAssignmentRequired` to `$true`.

Frequently Asked Questions

Why do attackers love AppId 14d82eec-204b-4c2f-b7e8-296a70dab67e?

It is Microsoft’s official pre-registered Graph PowerShell client ID—allowing attackers to query directories and mailboxes without deploying custom apps.

How can I block regular employees from using Graph PowerShell or Azure CLI?

Open the Enterprise Application in Entra ID, set "Assignment required?" to Yes, and assign only authorized IT/SecOps security groups (plus apply Conditional Access).

Does AuditVane show AppId fields from both Purview and Entra logs?

Yes! AuditVane normalizes AppId/appDisplayName into the ClientApp column and displays full AppAccessContext keys in the Event Inspector.

Can standard users read the entire employee directory via Graph CLI?

Yes—unless Entra "Restrict access to Microsoft Entra administration portal" and directory enumeration restrictions are configured, default User permissions allow reading basic profiles of other users.

Related Forensics Guides