← All posts

Microsoft Intune Field Manual: Architecture, Build, SIEM Logging, DFIR and Security Review

On this page

Microsoft Intune field manual: architecture, build, network, SIEM logging, DFIR and security review

Intune is one of those platforms everyone in IT touches and few people see completely. The endpoint team sees profiles and apps, the identity team sees Conditional Access, and the SOC sees… usually nothing, until the day something goes wrong. In March 2026, attackers holding a single administrator account used Stryker’s own Intune tenant to remote-wipe a very large number of corporate and personal devices — without deploying any malware at all. A management plane that can run code as SYSTEM on every laptop is also a weapon.

This is the Intune explanation I wish I’d had: architecture and network first, then every major module and a practical build plan, and finally what security teams care about most — SIEM logging, DFIR on endpoints and on the tenant, and a security review. Every script is downloadable at the end.

Freshness check: Intune changes monthly. Everything here was checked against Microsoft’s documentation as of October 2026, including the network endpoint list, the diagnostic log categories and the July 2026 licensing changes. Always re-check the linked official pages before you change a firewall or a production policy.

Intune in one picture: the architecture

Intune is a cloud-only, multi-tenant SaaS service running on Azure. There is no server to install: your tenant lives in a regional scale unit (you can see it under Tenant administration → Tenant status → Tenant location, for example “Europe 0202”). Everything else is built around three things: Microsoft Entra ID for identity, push channels to wake devices up, and connectors to the outside world:

ADMIN PLANE Intune admin center Microsoft Graph API (beta/v1.0) PowerShell · automation apps Security Copilot agents MICROSOFT ENTRA ID users · groups · admin roles device objects (isCompliant) Conditional Access PIM · sign-in & audit logs TELEMETRY OUT Diagnostic settings → Log Analytics / Sentinel Event Hubs → any SIEM Storage (archive) INTUNE SERVICE · regional scale unit Enrollment Configuration Compliance Apps & MAM Endpoint security Updates Scripts & remediation Remote actions RBAC · MAA · audit PUSH CHANNELS (wake-up only) WNS (Windows) · APNs (Apple) · FCM (Android) the device then checks in over HTTPS MANAGED DEVICES Windows · macOS · iOS/iPadOS · Android · Linux MDM stack + Intune Management Extension policy / status CONNECTORS Defender for Endpoint · Apple ABM/ASM (ADE, VPP) + APNs · Managed Google Play · Cert Connector Cloud PKI · ConfigMgr co-management · Microsoft Tunnel · partner MTD · ServiceNow

Three facts from this picture are worth remembering:

  1. Push is only a doorbell. WNS, APNs and FCM never carry policy. They only tell the device “check in now”. The device then pulls everything over HTTPS from Intune.
  2. Compliance becomes identity. Intune writes the device’s compliance state to its Entra ID device object, and Conditional Access reads it from there. That is how “only healthy devices can open email” works.
  3. Everything is an API. The admin center is just a client of Microsoft Graph. Anything an admin can click, a script (or an attacker with a token) can do, which matters a lot later in this article.

How a Windows device actually talks to Intune

Windows has two management agents, and you need to know both for troubleshooting and for forensics:

1 · Join Entra join / Autopilot 2 · Enroll MDM auto-enrollment 3 · Certificate MDM cert (LM\My) 4 · Managed two agents start AGENT A · built-in OMA-DM client Speaks SyncML over HTTPS to *.manage / *.dm Applies CSP policies (settings catalog, compliance, BitLocker, Defender, LAPS…) Check-in cadence after enrollment every 3 min for the first 15 min every 15 min for the next 2 hours then about every 8 hours + immediately after a WNS push Task: \Microsoft\Windows\EnterpriseMgmt\{GUID} AGENT B · Intune Management Extension Installed automatically when you assign Win32 apps, platform scripts, remediations, custom compliance, EPM, BIOS config Behaviour checks in about every 60 minutes, at service start and after reboot runs code via AgentExecutor.exe as SYSTEM (or as the user) Logs: ProgramData\…\IntuneManagementExtension

The practical meaning: settings (CSP policies) can take up to eight hours to land, unless the device gets a push or the user clicks Sync. Apps and scripts follow the IME’s hourly cycle. When a user says “the policy didn’t apply”, the first question is always “which agent delivers it?”.

In an incident: The same split matters for an incident. A malicious script pushed from a compromised admin account typically reaches most online Windows devices within about an hour. A malicious configuration spreads more slowly, unless the attacker also triggers a sync.

Licensing in 2026 (what changed in July)

Microsoft’s December 2025 packaging announcement took effect on 1 July 2026. Several features that used to be paid Intune Suite add-ons are now part of the Microsoft 365 E3 and E5 plans:

Capability Plan 1 (M365 E3/E5, Business Premium, EMS) Now in M365 E3 Now in M365 E5
MDM, MAM, compliance, config, apps, endpoint security, updates ✅ ✅ ✅
Remote Help add-on before ✅ ✅
Advanced Analytics (device query, timeline, battery health…) add-on before ✅ ✅
Microsoft Tunnel for MAM, specialty devices, firmware updates add-on before ✅ ✅
Endpoint Privilege Management (EPM) add-on before — ✅
Enterprise App Management (app catalog, auto-updates) add-on before — ✅
Microsoft Cloud PKI add-on before — ✅
Security Copilot in Intune (agents) — — ✅

Licensing caveat: This table summarises the official announcement at a high level. Check your agreement and the Microsoft licensing guide for your exact SKUs before planning a rollout around a feature.

The modules, one by one

Every major area of Intune, what it is for, and the one thing I always check in it:

Module What it does Key building blocks What I always check
Enrollment Brings devices under management Windows Autopilot (and Autopilot device preparation), Apple ADE via ABM/ASM, Android Enterprise (work profile, fully managed, dedicated), AOSP, macOS ADE + Platform SSO Enrollment restrictions: who can enroll what, and are personal Windows devices blocked?
Device configuration Pushes settings Settings catalog (preferred), templates, administrative templates (ADMX), custom OMA-URI, Group Policy analytics Conflicts. One setting configured twice gives an error, not a “winner”
Compliance Defines “healthy” Compliance policies, actions for noncompliance (mark, email, retire), custom compliance scripts, device health attestation “Mark devices with no compliance policy as” = Not compliant
Conditional Access (Entra) Turns compliance into access decisions “Require device to be marked as compliant”, app protection policy grants, filters for devices Is the policy really enforced, or still report-only?
Apps Deploys and updates software Win32 (.intunewin), Microsoft Store (winget), LOB, Microsoft 365 Apps, Enterprise App Catalog, Apple VPP, Managed Google Play Who can create Win32 apps? An app is just code that runs as SYSTEM
App protection (MAM) Protects data inside apps, even on unmanaged phones App protection policies (copy/paste, save-as, PIN, wipe corporate data), app configuration policies BYOD covered without forcing full enrollment
Endpoint security Security workloads, policy by policy Antivirus, firewall, attack surface reduction (ASR), disk encryption (BitLocker/FileVault), EDR onboarding, account protection, Windows LAPS, security baselines Tamper protection on, and BitLocker keys escrowed to Entra ID
Windows updates Patch management Update rings, feature updates, quality updates (with expedite), driver updates, hotpatch, Windows Autopatch A pilot ring that really receives updates first
Scripts & remediations Runs code on devices Platform scripts (once), remediations (detection + fix on a schedule, or on demand), macOS shell scripts The most powerful and most dangerous feature. Protect it with Multi Admin Approval
Remote actions Act on one device or in bulk Sync, restart, Defender scan, rotate LAPS/BitLocker, collect diagnostics, locate, retire, wipe, delete Who holds wipe rights, and is it protected by MAA?
EPM Removes local admin without breaking work Elevation rules (automatic, user-confirmed, support-approved), elevation reports Rules by file hash or certificate, not only by file name
Remote Help Secure helpdesk screen sharing Role-based sessions, logged in Intune Session logs reviewed and RBAC scoped
Advanced Analytics Live and historical device data Device query (KQL on one device, in near real time), multi-device query, timeline, anomalies Extremely useful for IR, as we will see later
Cloud PKI Certificates without an on-premises CA Root and issuing CAs in the cloud, SCEP profiles Certificate templates scoped to the right devices
Tenant administration Governs the tenant RBAC roles and scope tags, Multi Admin Approval, diagnostic settings, connectors, audit logs, terms and conditions Everything in the security review section below

Network topology and connectivity

Intune needs no inbound ports. Every connection is outbound from the device, mostly TCP 443, to Microsoft’s edge (Azure Front Door). Most of the work is making sure your proxy, firewall and TLS inspection don’t break that path:

CORPORATE NETWORK 💻 LaptopsDO peering 7680 📦 ConnectedCache (optional) 🔐 Intune Certificate Connectornext to your CA (outbound only) Proxy / SWG / firewall TLS inspection BYPASS for *.manage · *.dm · attestation REMOTE / HOME DEVICES direct to internet, or via SSE / VPN. Split-tunnel Intune if you use a VPN TCP 443 (80 for some CDN) Azure Front Door Intune service*.manage / *.dm.microsoft.com Entra IDlogin.microsoftonline.com … IME / Win32 CDNimeswd{a|b|c}-afd-*.manage… Push*.notify / *.wns.windows.com Updates & DO*.delivery.mp / *.do.dsp… Attestation (MAA)intunemaape*.attest.azure.net Apple / GoogleAPNs 443/5223 · FCM · Play

These are the rules I follow, all taken from Microsoft’s official endpoint page:

Requirement Detail
Core service *.manage.microsoft.com, manage.microsoft.com, *.dm.microsoft.com, EnterpriseEnrollment.manage.microsoft.com on TCP 80/443. If your firewall can’t use FQDNs, allow the Intune and AzureFrontDoor.MicrosoftSecurity IP ranges
No TLS inspection Inspection is not supported for *.manage.microsoft.com, *.dm.microsoft.com, the attestation endpoints, Defender for Endpoint, EPM and the Store API endpoints. Inspecting them breaks enrollment and check-ins, and makes compliance fail
Unauthenticated proxy Some tasks need unauthenticated proxy access to manage.microsoft.com, *.azureedge.net and graph.microsoft.com. Remember that SYSTEM can’t answer a proxy login prompt
Win32 apps and scripts Region-specific CDNs (for example imeswdb-afd-primary.manage.microsoft.com for Europe), and the proxy must allow HTTP partial responses (byte ranges)
Windows push *.notify.windows.com, *.wns.windows.com on 443. Without them, remote actions wait for the next scheduled check-in
Health attestation Windows 11 uses Microsoft Azure Attestation (intunemaape*.attest.azure.net) for your tenant’s region. If it’s blocked, devices with BitLocker, Secure Boot or Code Integrity compliance rules become noncompliant
Delivery Optimization *.do.dsp.mp.microsoft.com, *.dl.delivery.mp.microsoft.com. Peer-to-peer traffic uses TCP 7680 (and 3544 for Teredo). Microsoft Connected Cache saves WAN bandwidth at large sites
Autopilot Windows Update endpoints, time.windows.com (UDP 123) and TPM attestation (ekop.intel.com, ftpm.amd.com, ekcert.spserv.microsoft.com)
Apple / Android APNs (TCP 443 and 5223 to 17.0.0.0/8), Firebase Cloud Messaging and the Android Enterprise hosts from Google’s own documentation

Microsoft also publishes a connectivity test script. Run it from a managed device as the user, and again as SYSTEM, because they often go through different proxy paths:

# Download Test-IntuneAFDConnectivity.ps1 from the "Network endpoints for Microsoft Intune" page, then:
.\Test-IntuneAFDConnectivity.ps1 -LogLevel Detailed -OutputPath "C:\Logs" -Verbose

# Run it as SYSTEM to test the device-context path (the one the agents use)
.\PsExec.exe -accepteula -i -s powershell.exe

Outdated scripts: Microsoft states that the old PowerShell scripts that read Intune endpoints from the Office 365 endpoint web service no longer return accurate data. Use the consolidated list on the official page instead.

How to build it: a phased implementation

Here’s how I would build an Intune tenant from zero, or rebuild one that grew without a plan. The order matters. Most failed rollouts enforce Conditional Access before compliance reporting is trustworthy.

0 Foundations — before the first device RBAC + scope tags · PIM · break-glass · naming · groups & filters · diagnostics ON 1 Pilot enrollment — IT devices only Enrollment restrictions · Autopilot profile · ADE/ABM · Android Enterprise binding · Company Portal 2 Security baseline — report first BitLocker · Defender + tamper · firewall · ASR audit→block · LAPS · compliance (CA report-only) 3 Apps & updates in rings Pilot → early adopters → broad · Win32 standard · update rings / Autopatch · MAM 4 Enforce — when compliance data is trusted CA "require compliant device" per app → all cloud apps · grace periods · exception process 5 Operate & defend SIEM detections · Multi Admin Approval · config backup · monthly review · stale device cleanup

Phase 0 — Foundations. Decide your RBAC model before anyone gets “Intune Administrator”. Use built-in Intune roles (Help Desk Operator, Application Manager, Policy and Profile Manager, Read Only Operator, Endpoint Security Manager) or custom roles, and limit each one with scope tags by region or business unit. The Entra “Intune Administrator” role should be eligible through PIM only, never permanent. Turn on diagnostic settings on day one. You can’t investigate logs that were never exported.

Phase 1 — Pilot enrollment. Block personal Windows enrollment and require corporate identifiers if needed. Register devices in Autopilot through your hardware vendor, and connect Apple Business Manager and Managed Google Play. Name groups and policies with a convention that tells you the platform, the purpose and the ring, for example WIN-SEC-BitLocker-Ring1.

Phase 2 — Security baseline. Build the baseline mostly in the settings catalog and endpoint security policies, because they are easier to review than templates. Start ASR rules in audit mode and move each one to block after reviewing the hits. Create compliance policies, and point Conditional Access at them in report-only mode.

Phase 3 — Apps and updates in rings. Use the same three rings for apps, updates and new policies, so a bad change only hits a small group first. Use assignment filters (by OS version, model or ownership) instead of creating hundreds of groups.

Phase 4 — Enforce. Look at the report-only results. When the number of “would be blocked” devices is low and explained, turn on enforcement, one app at a time.

Phase 5 — Operate. Back up your configuration, monitor the SIEM detections from the next section, and review the tenant monthly with the security review script at the end.

Here is how compliance turns into an access decision. It is the heart of a Zero Trust design with Intune:

Deviceevaluates rules Intunecompliance state Entra deviceisCompliant = true ConditionalAccess at sign-in ✔ access ✖ block / remediate A compliance setting nobody enforces in CA is only a report. A CA policy without trusted compliance data is only an outage.

A useful habit from day one is a configuration backup, so you can diff policies after an incident. This snippet exports the main policy types as JSON with Microsoft Graph PowerShell:

Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All","DeviceManagementApps.Read.All" -NoWelcome
$base  = "https://graph.microsoft.com/beta/deviceManagement"
$types = "configurationPolicies","deviceConfigurations","deviceCompliancePolicies",
         "deviceManagementScripts","deviceHealthScripts","intents"
$out   = ".\intune-backup\$(Get-Date -f yyyyMMdd)"
foreach ($t in $types) {
    $null = New-Item -ItemType Directory -Path "$out\$t" -Force
    $uri  = "$base/$t"
    while ($uri) {
        $page = Invoke-MgGraphRequest -Method GET -Uri $uri -OutputType PSObject
        foreach ($p in $page.value) {
            $p | ConvertTo-Json -Depth 20 | Set-Content "$out\$t\$($p.id).json"
        }
        $uri = $page.'@odata.nextLink'
    }
}

Full-fidelity backup: Settings catalog policies (configurationPolicies) keep their individual settings in a separate /settings relationship. For a full-fidelity backup, also request configurationPolicies/{id}?$expand=settings, or use a maintained community tool such as IntuneManagement or Microsoft365DSC.

Logging: what Intune records

Now the part security teams usually miss. Intune telemetry comes from four different places, and you need all of them to tell a complete story:

Source What’s in it Where it lives Latency
Intune AuditLogs Every change and remote action: create/update/delete/assign of policies, apps and scripts, wipes, retires, role changes, MAA approvals. Who, when, which object Diagnostic setting → IntuneAuditLogs table Sent immediately (usually visible within 30 min)
Intune OperationalLogs Enrollment successes and failures, noncompliant device details → IntuneOperationalLogs Immediately
DeviceComplianceOrg Organizational compliance report, device by device → IntuneDeviceComplianceOrg Once per 24 h, up to 48 h
IntuneDevices Device inventory: name, OS, owner, compliance, last contact → IntuneDevices Once per 24 h, up to 48 h
Entra ID sign-in + audit Who signed in to the Intune admin center or Graph, from where, with what MFA, plus role assignments and PIM activations Entra diagnostic settings → SigninLogs, AuditLogs, AADNonInteractiveUserSignInLogs, AADServicePrincipalSignInLogs Minutes
Microsoft Graph activity logs Every Graph API call: URI, method, app, IP, status. Shows scripted or automated Intune abuse Entra diagnostic settings → MicrosoftGraphActivityLogs Minutes
Defender for Endpoint What actually ran on the device: AgentExecutor → powershell.exe, files, network Defender XDR advanced hunting / Sentinel Near real time
Device-local logs IME logs, MDM event logs, registry. The device’s own view On the endpoint (see the DFIR section) Collect on demand

Duplicates are normal: Intune’s own documentation says the export pipeline might duplicate up to 100% of the data published in a 24-hour period, and that the log schemas can change. Your SIEM pipeline must de-duplicate, and your detections should use has and contains instead of exact string matches.

Getting Intune telemetry into a SIEM, step by step

The answer to “can it go to our SIEM?” is yes, and there are three supported paths. All of them start from the same place: Intune Diagnostic settings.

INTUNE Reports → Diagnostic settings ☑ AuditLogs ☑ OperationalLogs ☑ DeviceComplianceOrg ☑ IntuneDevices ENTRA ID (same pattern) SignInLogs · AuditLogs · MicrosoftGraphActivityLogs ① Log Analyticsworkspace ② Event Hubsinsights-logs-<category> ③ Storage accountcheap long retention Microsoft Sentinelnative KQL tables Any SIEM / data lake Splunk (MSCS add-on) QRadar (Event Hubs protocol) Elastic · Sumo · custom code Forensic archiveimmutable, 1–7 years Alternative ④: pull /deviceManagement/auditEvents from Microsoft Graph on a schedule (no Azure subscription needed).

Step 1 — Prerequisites. You need an Azure subscription in the same tenant, an account with the Intune Administrator role (Entra), and one of the destinations: a Log Analytics workspace, an Event Hubs namespace, or a general-purpose storage account.

Step 2 — Create the destination. For a non-Microsoft SIEM, create an Event Hubs namespace and a listen-only key for the SIEM:

az group create -n rg-secops-intune -l westeurope
az eventhubs namespace create -g rg-secops-intune -n eh-intune-logs --sku Standard
# Azure Monitor creates one hub per category (insights-logs-auditlogs, ...) automatically.
# Give the SIEM a listen-only key - never the RootManageSharedAccessKey:
az eventhubs namespace authorization-rule create -g rg-secops-intune \
   --namespace-name eh-intune-logs -n siem-listen --rights Listen
az eventhubs namespace authorization-rule keys list -g rg-secops-intune \
   --namespace-name eh-intune-logs -n siem-listen --query primaryConnectionString -o tsv

Step 3 — Turn on the Intune diagnostic setting. In the Intune admin center go to Reports → Diagnostic settings → Add diagnostic setting. Select all four log categories (AuditLogs, OperationalLogs, DeviceComplianceOrg, IntuneDevices), then choose Send to Log Analytics workspace (your Sentinel workspace), Stream to an event hub (your SIEM namespace), and/or Archive to a storage account. Save.

Step 4 — Do the same in Entra ID. In the Entra admin center go to Monitoring & health → Diagnostic settings, and send SignInLogs, AuditLogs, NonInteractiveUserSignInLogs, ServicePrincipalSignInLogs and MicrosoftGraphActivityLogs to the same destination. Without these you can see what happened in Intune, but not how the actor got in.

Step 5 — Connect the SIEM.

SIEM How it reads the data
Microsoft Sentinel Nothing to install. The tables (IntuneAuditLogs, IntuneOperationalLogs, IntuneDeviceComplianceOrg, IntuneDevices) appear in the workspace
Splunk Splunk Add-on for Microsoft Cloud Services → Azure Event Hub input with the listen key (sourcetype mscs:azure:eventhub)
IBM QRadar Microsoft Azure Event Hubs protocol on a log source with the connection string
Elastic / Sumo Logic / others Their Azure Event Hubs integrations, or a small consumer like the one below

If your SIEM has no Event Hubs connector, this small consumer reads the hub, removes duplicates and forwards clean JSON lines. Replace forward() with your SIEM’s HTTP or syslog input:

"""Read Intune diagnostic logs from Azure Event Hubs, de-duplicate, forward as JSON lines."""
import hashlib, json, os
from azure.eventhub import EventHubConsumerClient

seen = set()                                   # use Redis / a DB with a TTL in production

def dedup_key(rec: dict) -> str:
    props = rec.get("properties") or {}
    if isinstance(props, str):
        props = json.loads(props)
    # audit records carry a unique AuditEventId; fall back to a content hash
    return props.get("AuditEventId") or hashlib.sha256(json.dumps(rec, sort_keys=True).encode()).hexdigest()

def forward(rec: dict):
    print(json.dumps({"source": "intune", "category": rec.get("category"),
                      "time": rec.get("time"), "operation": rec.get("operationName"),
                      "identity": rec.get("identity"), "raw": rec}))   # -> replace with your SIEM's HTTP/syslog input

def on_event(partition_context, event):
    for rec in json.loads(event.body_as_str())["records"]:       # Azure Monitor wraps rows in "records"
        key = dedup_key(rec)
        if key in seen:
            continue                                              # Intune can re-send up to 100% of a day's data
        seen.add(key)
        forward(rec)
    partition_context.update_checkpoint(event)

client = EventHubConsumerClient.from_connection_string(
    os.environ["EH_CONN"], consumer_group="siem", eventhub_name="insights-logs-auditlogs")
with client:
    client.receive(on_event=on_event, starting_position="-1")

Consumer groups: Create a dedicated consumer group for each reader (siem, archive, …). Two readers on the same consumer group fight over partitions and lose events. Also note that this in-memory checkpoint is only for testing. In production, use a blob checkpoint store so a restart doesn’t replay or skip data.

Step 6 — Validate. Make a harmless change, like renaming a test policy, and confirm the event arrives with the right actor:

IntuneAuditLogs
| where TimeGenerated > ago(1h)
| extend P = todynamic(Properties)
| project TimeGenerated, OperationName, Identity, ResultType,
          Targets = tostring(P.TargetDisplayNames), ActorType = tostring(P.ActorType)
| order by TimeGenerated desc

Detections worth building first

These are the analytics rules I would deploy on day one. They focus on Intune used as a weapon, because that is the scenario with the largest blast radius.

1. Mass wipe or retire (the Stryker pattern)

IntuneAuditLogs
| where TimeGenerated > ago(1h)
| where OperationName has_any ("wipe", "retire", "delete") and OperationName has "ManagedDevice"
| mv-expand Target = todynamic(Properties).TargetObjectIds to typeof(string)
| summarize Devices = dcount(Target), Ops = make_set(OperationName),
            First = min(TimeGenerated), Last = max(TimeGenerated)
            by Identity, bin(TimeGenerated, 15m)
| where Devices >= 5                                  // tune to your normal helpdesk volume

2. A script or remediation created and assigned by the same person within a short window

let window = 2h;
IntuneAuditLogs
| where TimeGenerated > ago(1d)
| where OperationName has_any ("DeviceManagementScript", "DeviceHealthScript", "DeviceShellScript")
| extend Action = case(OperationName has "Create", "create", OperationName has "Assign", "assign",
                       OperationName has "Patch", "update", "other")
| summarize Actions = make_set(Action), Names = make_set(tostring(todynamic(Properties).TargetDisplayNames)),
            First = min(TimeGenerated), Last = max(TimeGenerated) by Identity
| where Actions has "assign" and (Actions has "create" or Actions has "update") and Last - First < window

3. RBAC changes and Multi Admin Approval tampering

IntuneAuditLogs
| where TimeGenerated > ago(1d)
| where OperationName has_any ("RoleAssignment", "RoleDefinition", "OperationApprovalPolic", "ScopeTag")
| project TimeGenerated, Identity, OperationName, Targets = tostring(todynamic(Properties).TargetDisplayNames)

4. Intune operations through Graph from an unusual app or IP

MicrosoftGraphActivityLogs
| where TimeGenerated > ago(1d)
| where RequestUri has "/deviceManagement/"
| where RequestMethod in ("POST", "PATCH", "DELETE")
| extend Op = case(RequestUri has "/wipe", "WIPE", RequestUri has "/retire", "RETIRE",
                   RequestUri has "deviceManagementScripts", "SCRIPT", RequestUri has "deviceHealthScripts", "REMEDIATION", "OTHER")
| summarize Calls = count(), Ops = make_set(Op), IPs = make_set(IPAddress)
            by AppId, UserId, ServicePrincipalId
| where Ops has_any ("WIPE", "RETIRE", "SCRIPT", "REMEDIATION")

5. Intune admin sign-in that doesn’t look like your admins

SigninLogs
| where TimeGenerated > ago(1d)
| where AppDisplayName has_any ("Microsoft Intune", "Microsoft Graph Command Line Tools", "Microsoft Graph PowerShell")
| where ResultType == 0
| extend Country = tostring(LocationDetails.countryOrRegion)
| summarize Countries = make_set(Country), IPs = make_set(IPAddress), Apps = make_set(AppDisplayName) by UserPrincipalName
| join kind=inner (IdentityInfo | where AssignedRoles has "Intune Administrator" | distinct AccountUPN)
    on $left.UserPrincipalName == $right.AccountUPN

6. What actually ran on endpoints from Intune (Defender for Endpoint)

DeviceProcessEvents
| where Timestamp > ago(1d)
| where InitiatingProcessFileName =~ "AgentExecutor.exe"
| where FileName in~ ("powershell.exe", "pwsh.exe", "cmd.exe")
| summarize Devices = dcount(DeviceId), Sample = any(ProcessCommandLine) by SHA256 = InitiatingProcessSHA256, FileName
| order by Devices desc

Test before alerting: The table names, OperationName values and Properties fields above match the documented schemas today, but Microsoft warns that these schemas can change. Test each rule against your own data before enabling it, and keep the matching broad (has_any) rather than exact.

DFIR on Intune — part 1: the three angles

In an investigation, Intune shows up in three very different roles:

🧾 Evidence source IME logs, MDM event logs, registry, cached scripts Audit, operational and Graph activity logs "What was pushed, and did it run?" 🧰 IR tool Device query (live KQL) On-demand remediations Collect diagnostics Rotate LAPS / BitLocker keys MDE isolate via Defender "Reach every device in under an hour" 🎯 Attack surface Compromised admin or Graph app = SYSTEM on the whole fleet Wipe · scripts · rogue app · disable Defender policy "Who controls the controller?"

DFIR on Intune — part 2: Windows endpoint artifacts

This is the reference table I use on a Windows endpoint. Every path here is written by the MDM stack or by the Intune Management Extension:

FILE SYSTEM C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\*.log · C:\Windows\IMECache\HealthScripts\ C:\Windows\IMECache\<appId>_<ver>\ · …\Intune Management Extension\Policies\{Scripts,Results} REGISTRY (HKLM\SOFTWARE\Microsoft\…) Enrollments\<GUID> · Provisioning\OMADM\Accounts · PolicyManager\current\device\<area> IntuneManagementExtension\{Win32Apps, Policies, SideCarPolicies} · EnterpriseResourceManager\Tracked EVENT LOGS DeviceManagement-Enterprise-Diagnostics-Provider/{Admin,Operational} · AAD/Operational ModernDeployment-Diagnostics-Provider/Autopilot · PowerShell/Operational (4104) · Defender EXECUTION EVIDENCE IntuneManagementExtension.exe → AgentExecutor.exe → powershell.exe -executionPolicy bypass -file … Tasks \Microsoft\Windows\EnterpriseMgmt\{GUID} · MDM cert "Microsoft Intune MDM Device CA" · dsregcmd /status
Artifact Location Forensic value
IntuneManagementExtension.log C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\ Main IME log: check-ins, policies received (with IDs), script processing
AgentExecutor.log same Every script/remediation execution: the command line, exit code and output path. The best “what ran” artifact
AppWorkload.log same Win32 app check-in, applicability, detection, download and install (since service release 2408)
HealthScripts.log same Remediations, custom compliance scripts, on-demand remediations
ClientHealth.log, Sensor.log, DeviceHealthMonitoring.log same Agent health and inventory sensors. Useful to prove the agent was running at a given time
Remediation scripts C:\Windows\IMECache\HealthScripts\<policyId>_<ver>\detect.ps1, remediate.ps1 The actual code, cached between runs
Win32 app content C:\Windows\IMECache\<appId>_<ver>\ and …\Microsoft Intune Management Extension\Content\ Unpacked installer during install. Usually removed afterwards, so check the $MFT and $UsnJrnl for traces
Platform scripts …\Microsoft Intune Management Extension\Policies\Scripts\ and \Results\ Script staged before execution and its output. Short-lived, so recover from the USN journal if gone
Enrollment record HKLM\SOFTWARE\Microsoft\Enrollments\<GUID> UPN, ProviderID = MS DM Server, discovery URL, enrollment type. Tells you which tenant manages the device
Applied policies HKLM\SOFTWARE\Microsoft\PolicyManager\current\device\<area> and \providers\<GUID>\ The current effective CSP values, for example whether Defender or ASR settings were changed by MDM
IME state HKLM\SOFTWARE\Microsoft\IntuneManagementExtension\Win32Apps\<SID>\<appId>, \Policies\<userId>\<scriptId>, \SideCarPolicies\ Per-app and per-script result, error codes and timestamps
MDM event log Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin 75/76 = auto-enrollment success/failure, 208/209 = OMA-DM session start/end, 404 = command failure, 813/814 = policy value set (integer/string)
Autopilot event log Microsoft-Windows-ModernDeployment-Diagnostics-Provider/Autopilot Profile download, OOBE progress. Shows when the device was provisioned
PowerShell logging Microsoft-Windows-PowerShell/Operational event 4104 Script block logging captures the content of Intune-delivered scripts, if enabled. Enable it via Intune

Collect first: IME logs roll over at about 3 MB, and the older file is renamed. On a busy device, a week of history can be gone. If you suspect Intune was abused, collect the logs first, before anyone “re-syncs” the device to test.

Triage collector. This script collects everything in the table above into one hashed zip. Run it elevated, or as SYSTEM through your EDR’s live response:

#Requires -RunAsAdministrator
<#  Invoke-IntuneTriage.ps1 - collect Intune / MDM artifacts from a Windows endpoint
    Run from an elevated prompt (or as SYSTEM via your EDR live response).          #>
param([string]$Root = "C:\IR")

$stamp = Get-Date -Format "yyyyMMdd_HHmmss"
$out   = Join-Path $Root "Intune_${env:COMPUTERNAME}_$stamp"
$null  = New-Item -ItemType Directory -Path $out\logs, $out\reg, $out\evtx, $out\cache -Force
$ime   = "${env:ProgramFiles(x86)}\Microsoft Intune Management Extension"

# 1. Intune Management Extension logs (Win32 apps, scripts, remediations)
Copy-Item "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\*" "$out\logs" -ErrorAction SilentlyContinue

# 2. Cached scripts and content - remediation scripts stay here between runs
Copy-Item "$env:windir\IMECache\HealthScripts" "$out\cache" -Recurse -ErrorAction SilentlyContinue
Get-ChildItem "$env:windir\IMECache", "$ime\Policies", "$ime\Content" -Recurse -Force -ErrorAction SilentlyContinue |
    Select-Object FullName, Length, CreationTimeUtc, LastWriteTimeUtc |
    Export-Csv "$out\cache\listing.csv" -NoTypeInformation

# 3. Registry: enrollment, applied policies, IME state
$keys = @{
    "enrollments"   = "HKLM\SOFTWARE\Microsoft\Enrollments"
    "omadm"         = "HKLM\SOFTWARE\Microsoft\Provisioning\OMADM"
    "policymanager" = "HKLM\SOFTWARE\Microsoft\PolicyManager"
    "ime"           = "HKLM\SOFTWARE\Microsoft\IntuneManagementExtension"
    "erm"           = "HKLM\SOFTWARE\Microsoft\EnterpriseResourceManager"
}
foreach ($k in $keys.GetEnumerator()) {
    reg.exe export $k.Value "$out\reg\$($k.Key).reg" /y | Out-Null
}

# 4. Event logs
$channels = @(
    "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin",
    "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Operational",
    "Microsoft-Windows-AAD/Operational",
    "Microsoft-Windows-ModernDeployment-Diagnostics-Provider/Autopilot",
    "Microsoft-Windows-PowerShell/Operational",
    "Microsoft-Windows-Windows Defender/Operational"
)
foreach ($c in $channels) {
    wevtutil.exe epl $c "$out\evtx\$($c -replace '[/ ]','_').evtx" 2>$null
}

# 5. Join state, MDM scheduled tasks, MDM certificates
dsregcmd.exe /status > "$out\dsregcmd.txt"
Get-ScheduledTask -TaskPath "\Microsoft\Windows\EnterpriseMgmt\*" -ErrorAction SilentlyContinue |
    Select-Object TaskPath, TaskName, State, Date, Author | Export-Csv "$out\enterprisemgmt_tasks.csv" -NoTypeInformation
Get-ChildItem Cert:\LocalMachine\My | Where-Object Issuer -like "*Intune*" |
    Select-Object Subject, Issuer, NotBefore, NotAfter, Thumbprint | Export-Csv "$out\mdm_certs.csv" -NoTypeInformation

# 6. Microsoft's own MDM diagnostics bundle
MdmDiagnosticsTool.exe -area "DeviceEnrollment;DeviceProvisioning;Autopilot" -zip "$out\MDMDiag.zip" | Out-Null

# 7. Hash everything, then zip
Get-ChildItem $out -Recurse -File | Get-FileHash -Algorithm SHA256 |
    Export-Csv "$out\manifest_sha256.csv" -NoTypeInformation
Compress-Archive -Path "$out\*" -DestinationPath "$out.zip" -Force
Write-Host "Collected: $out.zip"

Turning IME logs into a timeline. IME logs use the CMTrace format, which is painful to read in Notepad and impossible to correlate. This function converts them into objects, including multi-line messages, so you can merge all logs into one sorted timeline:

function ConvertFrom-CMTraceLog {
    <# Turns IME / CMTrace-format logs into objects you can sort, filter and export #>
    param([Parameter(Mandatory)][string[]]$Path)
    $rx = '<!\[LOG\[(?<msg>[\s\S]*?)\]LOG\]!><time="(?<time>[\d:.]+)[^"]*" date="(?<date>[\d-]+)" component="(?<comp>[^"]*)"[^>]*type="(?<type>\d)" thread="(?<thread>\d+)"'
    foreach ($file in Get-ChildItem $Path) {
        $text = Get-Content $file.FullName -Raw
        foreach ($m in [regex]::Matches($text, $rx)) {
            $ts = [datetime]::ParseExact("$($m.Groups['date'].Value) $($m.Groups['time'].Value.Substring(0,12))",
                                         "M-d-yyyy HH:mm:ss.fff", [cultureinfo]::InvariantCulture)
            [pscustomobject]@{
                Time      = $ts
                Log       = $file.Name
                Component = $m.Groups['comp'].Value
                Severity  = @{ '1'='Info'; '2'='Warning'; '3'='Error' }[$m.Groups['type'].Value]
                Thread    = $m.Groups['thread'].Value
                Message   = $m.Groups['msg'].Value.Trim()
            }
        }
    }
}
# Example: one timeline across all IME logs, errors only
# ConvertFrom-CMTraceLog .\logs\*.log | Where-Object Severity -eq 'Error' | Sort-Object Time | Export-Csv timeline.csv -NoTypeInformation

Time zones: IME timestamps are in the device’s local time, and the time zone offset is written next to the time value. Convert everything to UTC before merging with SIEM data, or your timeline will be shifted by hours.

macOS, iOS and Android, briefly. On macOS, the Intune agent logs live in /Library/Logs/Microsoft/Intune/ (system) and ~/Library/Logs/Microsoft/Intune/ (user). The installed MDM profiles are listed with sudo profiles show -all, and MDM activity appears in the unified log: log show --predicate 'subsystem == "com.apple.ManagedClient"' --last 7d. On iOS and Android there is very little to collect from the device itself. Use the Company Portal “send logs” feature, an iOS sysdiagnose, or an Android bug report, and rely mostly on the cloud-side logs.

DFIR on Intune — part 3: investigating the tenant

When the question is “was our Intune used against us?”, the evidence is in the cloud. This is the workflow I follow:

  1. Preserve first. Export IntuneAuditLogs, Entra AuditLogs, SigninLogs and MicrosoftGraphActivityLogs for the incident window, plus the current configuration (backup script above). Don’t rely on portal retention.
  2. Find the actor. Filter the audit log for wipe/retire/delete, script and app creation or assignment, and RBAC changes. Note the Identity and the time.
  3. Find how they got in. Pivot to the sign-in logs for that identity: IP, country, device, MFA method, the app used (admin center vs Graph PowerShell), and any PIM activation just before.
  4. Recover what was pushed. Graph returns the full content of every platform script and remediation, so you can see exactly what code ran as SYSTEM.
  5. Measure the blast radius. Assignment groups → member devices, then the device-side AgentExecutor.log and MDE DeviceProcessEvents to confirm execution.

This read-only script does steps 2 and 4 for you: it exports the audit trail and decodes every script and remediation in the tenant, with hashes:

<#  Get-IntuneAdminActivity.ps1 - pull Intune audit events and the content of every
    PowerShell script / remediation in the tenant (read-only).                      #>
param([int]$Days = 30, [string]$Out = ".\intune-ir")

Connect-MgGraph -Scopes "DeviceManagementApps.Read.All","DeviceManagementConfiguration.Read.All",
                        "DeviceManagementManagedDevices.Read.All" -NoWelcome
$null = New-Item -ItemType Directory -Path $Out -Force

function Get-GraphAll([string]$Uri) {            # follows @odata.nextLink paging
    while ($Uri) {
        $page = Invoke-MgGraphRequest -Method GET -Uri $Uri -OutputType PSObject
        $page.value
        $Uri = $page.'@odata.nextLink'
    }
}

# 1. Audit events (who did what, from where, to which object)
$since = (Get-Date).ToUniversalTime().AddDays(-$Days).ToString("yyyy-MM-ddTHH:mm:ssZ")
Get-GraphAll "https://graph.microsoft.com/beta/deviceManagement/auditEvents?`$filter=activityDateTime ge $since" |
    Select-Object activityDateTime, activity, activityType, activityOperationType, activityResult, componentName,
        @{n='Actor';   e={ $_.actor.userPrincipalName ?? $_.actor.applicationDisplayName }},
        @{n='ActorIP'; e={ $_.actor.ipAddress }},
        @{n='Targets'; e={ ($_.resources.displayName) -join '; ' }} |
    Sort-Object activityDateTime |
    Export-Csv "$Out\audit_events.csv" -NoTypeInformation

# 2. Platform scripts: decode the actual code that was (or will be) run as SYSTEM
$scripts = foreach ($s in Get-GraphAll "https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts") {
    $full = Invoke-MgGraphRequest -Method GET -OutputType PSObject `
            -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceManagementScripts/$($s.id)"
    $code = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($full.scriptContent))
    $code | Set-Content "$Out\script_$($s.id)_$($s.fileName)"
    [pscustomobject]@{ Id=$s.id; Name=$s.displayName; File=$s.fileName; RunAs=$s.runAsAccount
                       Created=$s.createdDateTime; Modified=$s.lastModifiedDateTime
                       SHA256=(Get-FileHash "$Out\script_$($s.id)_$($s.fileName)").Hash }
}
$scripts | Export-Csv "$Out\scripts.csv" -NoTypeInformation

# 3. Remediations (detection + remediation pairs)
foreach ($r in Get-GraphAll "https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts") {
    $full = Invoke-MgGraphRequest -Method GET -OutputType PSObject `
            -Uri "https://graph.microsoft.com/beta/deviceManagement/deviceHealthScripts/$($r.id)"
    foreach ($part in "detection","remediation") {
        $b64 = $full."${part}ScriptContent"
        if ($b64) { [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($b64)) |
                    Set-Content "$Out\remediation_$($r.id)_$part.ps1" }
    }
}
Write-Host "Done. Review $Out\audit_events.csv first, then diff scripts against your known-good baseline."

Requirements: This script needs PowerShell 7 or later (it uses the ?? operator) and the Microsoft Graph PowerShell SDK. Run it from a clean, trusted admin workstation, not from a device managed by the tenant you are investigating.

Using Intune as an IR tool. During an incident the same power works for you:

Need Intune feature Tip
Ask one device a question now Device query (Advanced Analytics) KQL against live device state: processes, files, registry, services, local users
Hunt across the fleet Multi-device query / MDE advanced hunting Inventory-based, so better for “which devices have X” than for live processes
Run a triage collector everywhere Remediations (on-demand or scheduled) with the triage script above, uploading to a locked-down storage account Test on one device first, and scope by group. Remember: this is also exactly what an attacker would do
Get Microsoft’s diagnostic bundle Collect diagnostics remote action Logs land in the admin center for 28 days
Contain a host Defender for Endpoint isolate (from Defender XDR), then Intune for follow-up Isolation keeps the Defender channel open, so you can still investigate
Kill a stolen credential Rotate LAPS password / BitLocker key, revoke the user’s sessions in Entra Rotate after the investigation has captured what it needs
Remove access from a lost device Retire (corporate data only) before wipe Wipe destroys evidence. Image first if the device is in scope

DFIR on Intune — part 4: when the admin account is the threat

This is the playbook for the worst case: an attacker controls an Intune administrator, or an app registration with Intune Graph permissions.

Admin identity phish · AiTM token · leaked app secret Intune / Graph admin center or scripted API calls 💥 Mass wipe / retire / delete devices 🐚 Script or remediation as SYSTEM 📦 "Required" Win32 app = malware 🛡️ Weaken Defender / ASR / firewall policy CONTROLS THAT BREAK THE CHAIN ① Phishing-resistant MFA + PIM (no standing Intune Admin) + CA for admin portals from compliant PAWs ② Multi Admin Approval on scripts, apps, device actions (wipe/retire/delete), compliance, config and RBAC ③ SIEM detections on mass actions + Graph activity · ④ least-privilege Graph apps, no client secrets

Containment, in this order:

  1. Stop the actor. Disable the account (or the app’s credentials), and revoke sessions with Revoke-MgUserSignInSession -UserId <upn>. Remove PIM eligibility until the investigation is finished.
  2. Stop pending damage. Remove assignments of any new or modified script, remediation or app. Check Devices → Monitor → Device actions for queued wipes or retires. Devices that are offline will run a queued wipe when they come back online.
  3. Look for persistence. New role assignments, new custom roles, scope tag changes, new app registrations or consents with DeviceManagement* permissions, new enrollment program tokens, changed MAA access policies, and a weakened Conditional Access policy.
  4. Use break-glass carefully. Your break-glass accounts are excluded from CA. Confirm they weren’t used, and rotate their credentials after the incident.
  5. Rebuild trust. Compare the configuration with your last known-good backup, restore it, and keep the diff as evidence.

Even for apps: Multi Admin Approval also covers application-authenticated Graph calls, not only clicks in the portal. An attacker with a stolen app secret still hits the approval gate, unless that app was explicitly excluded in the access policy. Keep that exclusion list empty, or very short.

Security review: the checklist

These are the checks I run when reviewing an Intune tenant, grouped by domain. Every “no” is a finding:

# Domain Check Why it matters
1 Admin access Intune Administrator is PIM-eligible only, with at most 2 standing break-glass exceptions Standing admin = permanent target
2 Admin access Phishing-resistant MFA (FIDO2/passkeys) + CA requiring a compliant privileged access workstation for the Intune and Graph admin apps Stops AiTM token theft, the most common path in
3 Admin access Custom RBAC roles with scope tags. Helpdesk can’t wipe, script or assign apps Limits what one stolen account can do
4 Admin access Multi Admin Approval for scripts, apps, device actions, compliance, configuration and RBAC The control that directly prevents the Stryker scenario
5 Admin access Graph app registrations with DeviceManagement*.ReadWrite.All or PrivilegedOperations.All reviewed, owned, certificate-based (no secrets), not excluded from MAA Automation is an admin too
6 Enrollment Personal Windows enrollment blocked; device limit per user; corporate identifiers if needed Stops rogue devices from becoming “trusted”
7 Enrollment Apple and Google tokens (APNs, ADE, VPP) owned by a shared service account, with renewal dates tracked An expired APNs certificate means re-enrolling every Apple device
8 Compliance “Devices with no compliance policy” = Not compliant; short grace period; minimum OS, encryption, Secure Boot, Defender risk level Unknown devices must not pass as compliant
9 Access CA requires compliant device (or app protection on mobile) for all cloud apps, enforced and not report-only Compliance without enforcement is only a report
10 Baseline BitLocker with key escrow, Defender with tamper protection, ASR in block mode, firewall, Windows LAPS, Credential Guard, PowerShell script block logging The device must be able to defend itself and record what happened
11 Apps Win32 app ownership and review process; Enterprise App Catalog or winget for third-party updates A rogue “required” app is code execution on every device
12 Updates Rings with a real pilot; quality update deadlines; reports reviewed monthly Unpatched endpoints are still the easiest way in
13 BYOD App protection policies on all mobile platforms; selective wipe tested Corporate data without corporate devices
14 Logging All four Intune log categories plus Entra sign-in/audit and Graph activity logs exported; retention ≥ 1 year; SIEM detections live You can’t investigate what you didn’t keep
15 Hygiene Stale devices (no check-in for 30–90 days) cleaned up; configuration backed up and diffed Every orphaned object is a hiding place

The following script automates part of this list using read-only Graph calls. It checks the default compliance posture, standing Intune admins, Multi Admin Approval, risky custom roles, enrollment restrictions and stale devices:

<#  Invoke-IntuneSecurityReview.ps1 - quick, read-only posture checks for an Intune tenant #>
Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All","DeviceManagementRBAC.Read.All",
                        "DeviceManagementServiceConfig.Read.All","RoleManagement.Read.Directory" -NoWelcome
$g = "https://graph.microsoft.com"
$results = [System.Collections.Generic.List[object]]::new()
function Add-Check($Area, $Check, $Pass, $Detail) {
    $results.Add([pscustomobject]@{ Area=$Area; Check=$Check; Status= if ($Pass) {'PASS'} else {'REVIEW'}; Detail=$Detail })
}

# 1. Devices without a compliance policy must be treated as non-compliant
$settings = (Invoke-MgGraphRequest -Method GET -Uri "$g/beta/deviceManagement" -OutputType PSObject).settings
Add-Check "Compliance" "No-policy devices = Not compliant" $settings.secureByDefault "secureByDefault=$($settings.secureByDefault)"

# 2. Standing Intune Administrators (Entra role template 3a2c62db-...)
$ia = (Invoke-MgGraphRequest -Method GET -Uri ("$g/v1.0/roleManagement/directory/roleAssignments?`$filter=" +
       "roleDefinitionId eq '3a2c62db-5318-420d-8d74-23affee5d9d5'") -OutputType PSObject).value
Add-Check "RBAC" "Permanent Intune Administrators <= 2 (use PIM)" ($ia.Count -le 2) "$($ia.Count) active assignment(s)"

# 3. Multi Admin Approval access policies
try {
    $maa = (Invoke-MgGraphRequest -Method GET -Uri "$g/beta/deviceManagement/operationApprovalPolicies" -OutputType PSObject).value
    $types = ($maa.policyType | Sort-Object -Unique) -join ', '
    Add-Check "RBAC" "Multi Admin Approval protects scripts, apps and wipe" ($maa.Count -ge 3) "Policies: $($maa.Count) [$types]"
} catch { Add-Check "RBAC" "Multi Admin Approval" $false "Could not read access policies: $($_.Exception.Message)" }

# 4. Custom Intune roles with wipe / script rights
$roles = (Invoke-MgGraphRequest -Method GET -Uri "$g/beta/deviceManagement/roleDefinitions" -OutputType PSObject).value
foreach ($r in $roles | Where-Object { -not $_.isBuiltIn }) {
    $acts = $r.rolePermissions.resourceActions.allowedResourceActions
    $risky = $acts | Where-Object { $_ -match 'Wipe|Retire|DeviceManagementScripts|RemoteTasks' }
    if ($risky) { Add-Check "RBAC" "Custom role '$($r.displayName)' has destructive rights" $false ($risky -join ', ') }
}

# 5. Enrollment restrictions: personally owned Windows blocked?
$restr = (Invoke-MgGraphRequest -Method GET -Uri "$g/beta/deviceManagement/deviceEnrollmentConfigurations" -OutputType PSObject).value |
         Where-Object { $_.'@odata.type' -like '*PlatformRestriction*' -and $_.platformType -eq 'windows' }
foreach ($p in $restr) {
    Add-Check "Enrollment" "Personal Windows enrollment blocked ($($p.displayName))" `
              $p.platformRestriction.personalDeviceEnrollmentBlocked "platformBlocked=$($p.platformRestriction.platformBlocked)"
}

# 6. Stale devices (no check-in for 30+ days) widen the attack surface
$stale = (Invoke-MgGraphRequest -Method GET -Uri ("$g/v1.0/deviceManagement/managedDevices?`$select=deviceName,lastSyncDateTime" +
          "&`$top=999") -OutputType PSObject).value | Where-Object { [datetime]$_.lastSyncDateTime -lt (Get-Date).AddDays(-30) }
Add-Check "Hygiene" "Devices not synced for 30+ days" ($stale.Count -eq 0) "$($stale.Count) stale device(s) (first page only)"

$results | Format-Table -AutoSize
$results | Export-Csv ".\intune-security-review.csv" -NoTypeInformation

Treat it as a start: Treat the output as a starting point for the review, not a score. Some Graph properties used here are on the beta endpoint and can change. If a check returns an error, verify that setting manually in the admin center.

Common mistakes I keep seeing

| Mistake | Consequence | Better | |—|—|—| | Everyone in IT is “Intune Administrator” | One phished helpdesk account can wipe the company | Custom roles + scope tags + PIM + MAA | | TLS inspection on all traffic | Random enrollment failures, devices fall out of compliance | Bypass the documented Intune endpoints | | Diagnostic settings never configured | No evidence when it matters | Enable on day one; Sentinel or Event Hubs + archive | | CA enforced on day one | Executives locked out, rollback, lost trust | Report-only first, enforce app by app | | Duplicate settings across policies | Conflicts and silent failures | One owner per setting; settings catalog; naming convention | | Wiping a compromised laptop immediately | The evidence is destroyed | Isolate → collect → image if in scope → then retire/wipe | | Remediations used as “free admin” with no review | A future attacker’s favourite feature is already normal noise | Code review, MAA, and the SIEM detection above |

Download the scripts

All the scripts from this article, ready to adapt:

Tested how: I tested every script for syntax, and tested the log parser and the Event Hubs de-duplication logic with sample data. The Graph scripts are read-only, but run them first in a test tenant or with a read-only account, and review the code before running anything as SYSTEM.

Protect the controller

Intune is far more than “the tool that installs apps”. It’s a cloud control plane with two agents on every Windows device, a compliance signal that drives access decisions, and the power to run code as SYSTEM across the fleet within an hour. Build it in phases — foundations and RBAC first, report-only before enforcement, rings for everything. Open only the outbound endpoints it needs and keep TLS inspection away from them. Send all four log categories, plus Entra sign-in and Graph activity logs, to your SIEM, and de-duplicate them. Learn where the IME and the MDM stack leave traces, so you can tell what was pushed and whether it ran. Above all, protect Intune itself: PIM, phishing-resistant MFA and Multi Admin Approval turn “one stolen account wipes the company” into “one stolen account files a request that someone rejects”.

Official references: Microsoft Intune documentation, network endpoints for Intune, routing Intune logs to Azure Monitor, Multi Admin Approval, and the Intune Graph API reference.