1. Resources
  2. Detection rules
  3. Device Management Graph Permission Granted to an Application

Device Management Graph Permission Granted to an Application detection rules

An attacker grants a service principal a Microsoft Graph application permission for Intune, such as DeviceManagementConfiguration.ReadWrite.All, and uses it to push scripts, apps or wipes to managed devices with no user sign-in.

Platform
Microsoft Intune
Severity
High
Log source
Microsoft Entra ID audit logs
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
A compromised identity with Privileged Role Administrator or Global Administrator, and a service principal the attacker controls or can add a credential to.
Impact
A non-human identity with tenant-wide Intune rights, including code execution as SYSTEM on managed Windows devices, configuration changes and device wipes.
Response
Remove the app role assignment and disable the service principal, contain the identity that made the grant, and undo what the application did in Intune.
Mitigation
Review which service principals hold device-management application permissions, and remove every grant without a documented owner and purpose.
Audit activity
Add app role assignment to service principal

How the attack works

Intune is managed through Microsoft Graph, and its application permissions let a service principal act without a signed-in user, MFA or user Conditional Access. DeviceManagementConfiguration.ReadWrite.All writes configuration and compliance policies and can also create platform scripts; DeviceManagementScripts.ReadWrite.All writes scripts and remediations; DeviceManagementApps.ReadWrite.All writes apps and their assignments; DeviceManagementRBAC.ReadWrite.All writes Intune roles and role assignments; DeviceManagementManagedDevices.PrivilegedOperations.All performs remote actions such as wipe and passcode reset; DeviceManagementServiceConfig.ReadWrite.All writes enrollment and connector settings. An application permission is granted for the whole tenant in Microsoft Entra ID; it is not handed out through an Intune role assignment with scope groups and scope tags.

Granting one of them needs Privileged Role Administrator or Global Administrator, or an application that already holds AppRoleAssignment.ReadWrite.All. An attacker at that level grants the permission to a service principal they control, because the application keeps working after the administrator account is cleaned up. Microsoft Entra ID logs each grant as Add app role assignment to service principal; the permission name is in TargetResources as the AppRole.Value modified property, which is what the rule matches. It reads the Microsoft Entra audit log (AuditLogs), not the Intune audit log.

What an attacker needs

  • A compromised identity with Privileged Role Administrator or Global Administrator, or an application that holds AppRoleAssignment.ReadWrite.All.
  • A service principal the attacker controls or can add a credential to.

Impact

A non-human identity with tenant-wide Intune rights: code execution as SYSTEM on managed Windows devices through scripts and apps, changes to compliance and security configuration, Intune role assignments for other identities, or device wipes. Multi Admin Approval also applies to application calls, but only for the resource types that have an access policy and only if the application is not on the policy's exclusion list.

Detection rules

Intune Device Management Graph Application Permission Granted to a Service Principal

Detects an app role assignment whose permission name (AppRole.Value in TargetResources) is one of the Microsoft Graph application permissions that write Intune configuration, scripts, apps, role-based access control or enrollment settings, or that perform remote actions such as wipe. Each of them lets the application change or act on every managed device in the tenant without a signed-in user.

LevelHighStatusExperimentalLog sourceMicrosoft Entra ID audit logs
title: Intune Device Management Graph Application Permission Granted to a Service Principal
id: 4da42aee-8efe-4954-8c90-76816ab03437
status: experimental
description: >-
  Detects an app role assignment whose permission name (AppRole.Value in
  TargetResources) is one of the Microsoft Graph application permissions that
  write Intune configuration, scripts, apps, role-based access control or
  enrollment settings, or that perform remote actions such as wipe. Each of
  them lets the application change or act on every managed device in the
  tenant without a signed-in user.
references:
  - https://attack.mitre.org/techniques/T1098/003/
  - https://learn.microsoft.com/en-us/graph/permissions-reference
  - https://learn.microsoft.com/en-us/entra/identity/monitoring-health/reference-audit-activities
author: Forestall
date: 2026-11-11
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: azure
  service: auditlogs
detection:
  selection:
    OperationName: Add app role assignment to service principal
    TargetResources|contains:
      - DeviceManagementConfiguration.ReadWrite.All
      - DeviceManagementScripts.ReadWrite.All
      - DeviceManagementApps.ReadWrite.All
      - DeviceManagementRBAC.ReadWrite.All
      - DeviceManagementManagedDevices.PrivilegedOperations.All
      - DeviceManagementServiceConfig.ReadWrite.All
  filter_failed:
    Result: failure
  condition: selection and not filter_failed
falsepositives:
  - Onboarding of endpoint management, patching, reporting and security tools that need these permissions; confirm a change record and filter the approved service principals by object ID in TargetResources.
level: high

False positives

  • Onboarding of endpoint management, patching, reporting and security tools that need these permissions; confirm a change record and filter the approved service principals by object ID in TargetResources.

Triage

  • Read the permission (AppRole.Value) and the receiving service principal in TargetResources, and the actor in InitiatedBy; a grant made by an application needs extra scrutiny.
  • Check who owns the service principal and its application, and which credentials were added to it recently.
  • Review the Intune audit log for changes made by that application afterwards (the actor is the application rather than a user).
  • If unauthorized, remove the app role assignment, disable the service principal, remove unknown credentials and review every Intune object it touched.

Response

Once the attack is confirmed:

  1. Contain the identity that made the grant. It held Privileged Role Administrator or Global Administrator, or was an application with AppRoleAssignment.ReadWrite.All, so revoke its sessions or credentials and review everything else it granted.
  2. Undo what the application did in Intune. Remove the scripts, remediations, apps and assignments it created, restore the policies it changed and remove the Intune role assignments it made.
  3. Treat the devices that ran a script or app from that application as compromised, and handle the users of those devices accordingly.
  4. Remove the application from the exclusion lists of Multi Admin Approval access policies if it was added to any.
  5. If the application is not yours, delete it after the evidence is saved. If it is a legitimate tool that was misused, replace its credentials and review who can own it or add credentials to it.
  6. After cleanup, compare the service principals that hold device-management application permissions with the approved list.

Mitigation

  • Review which service principals hold device-management application permissions and remove every grant without a documented owner and purpose; prefer the read-only variants.
  • Limit Privileged Role Administrator and Global Administrator to a few PIM-managed accounts and require a change record for admin consent to these permissions.
  • Restrict who can own or add credentials to the applications that keep such a permission, and alert on credential and owner changes to them.
  • Create Multi Admin Approval access policies for scripts, apps, device actions and role-based access control, and keep their application exclusion lists empty or short.

Frequently asked questions

Which log does this rule read, the Intune audit log or the Microsoft Entra audit log?

The Microsoft Entra audit log. An application permission is granted in Microsoft Entra ID and logged there as Add app role assignment to service principal, with the permission name in the AppRole.Value modified property. The Intune audit log shows only what the application does with the permission afterwards.

Do Intune scope groups and scope tags limit what the application can reach?

No. An application permission is granted for the whole tenant in Microsoft Entra ID. It is not handed out through an Intune role assignment, so scope groups and scope tags do not narrow it. The application can change or act on every managed device.

Does Multi Admin Approval stop an application that holds one of these permissions?

Only in part. Multi Admin Approval also applies to application calls, but only for the resource types that have an access policy, and only if the application is not on the policy's exclusion list. Keep policies in place for scripts, apps, device actions and role-based access control, and keep the exclusion lists short.

Does cleaning up the administrator account that made the grant remove the application's access?

No. The permission belongs to the service principal, and the application keeps working after the administrator account is cleaned up. Remove the app role assignment and the credentials you do not recognize on the application as separate steps.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.