Black Friday sale: an extra 40% off every course until Monday, November 30.New Year sale: an extra 30% off every course until Friday, January 1.Memorial Day sale: an extra 25% off every course until Monday, May 31.SysAdmin Day sale: an extra 25% off every course until Sunday, August 1.Back to School sale: an extra 25% off every course until Sunday, August 22.Labor Day sale: an extra 25% off every course until Monday, September 6.Black Friday sale: an extra 40% off every course until Monday, November 29.New Year sale: an extra 30% off every course until Saturday, January 1.Choose your certification →

Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

6.1.1. PowerShell and Microsoft Graph for Intune

💡 First Principle: Microsoft Graph is the programmable front door to Intune. Each call carries a token that says who is calling and which permission scopes they hold, and Intune checks those scopes, and for a signed-in user that user's Intune role, before doing anything. Get the identity and the scope right and almost any admin task can be scripted. Get either wrong and you get a 403, however correct the code is.

Picture a security team that wants a CSV of every device's compliance state each Monday at 7 a.m. A script that signs in as a registered application, asks Graph to export the report and drops the file in a shared folder removes the human from the loop.

Two kinds of permission. Intune supports both delegated permissions, where a signed-in admin acts through the app, and application permissions, where the app acts as itself with no user present. Both come in read and write forms, for single-tenant and multi-tenant apps. You register the app in the Microsoft Entra admin center > App registrations > New registration, add API permissions > Microsoft Graph, choose Application or Delegated permissions, and grant admin consent. Every Intune scope currently requires administrator access. A delegated call also needs matching Intune role permissions, so a token with the right scope still fails if the signed-in admin's Intune role can't do the job. A 403 "Application is not authorized" points to missing scopes or roles.

The scope names map onto the admin center's areas:

Permission scope (Read.All / ReadWrite.All)What it covers
DeviceManagementManagedDevicesManaged devices, device categories, detected apps. ReadWrite adds locate device and similar actions
DeviceManagementManagedDevices.PrivilegedOperations.AllUser-impacting remote actions: retire, wipe, remote lock, passcode reset, reboot
DeviceManagementConfigurationDevice configuration, compliance policies, notification messages
DeviceManagementAppsClient apps, app protection policies, app configurations
DeviceManagementScriptsPlatform scripts, Remediations (deviceHealthScripts), custom compliance scripts
DeviceManagementRBACRole definitions and role assignments
DeviceManagementServiceConfigEnrollment, APNs, Apple DEP and VPP, Cloud PKI, branding

Notice two things the table makes visible. App protection policies sit under Apps, not Configuration. And scripts have their own scope: as of July 31, 2025, Graph replaced DeviceManagementConfiguration for the five script endpoints with DeviceManagementScripts.ReadWrite.All. An older automation that managed Remediations with only the Configuration scope stops working until it gets the new scope.

The Graph PowerShell SDK. Microsoft Graph PowerShell replaces the old Azure AD PowerShell and MSOnline modules. It runs on PowerShell 7 and Windows PowerShell 5.1, comes as two modules, Microsoft.Graph (v1.0) and Microsoft.Graph.Beta, and always installs Microsoft.Graph.Authentication. Microsoft recommends v1.0 for production scripts because beta endpoints can change. Permissions aren't pre-authorized; you consent per scope, in the spirit of least privilege. The way you connect tells you which kind of identity the script runs as:

Sign-in styleExampleRuns as
DelegatedConnect-MgGraph -Scopes "DeviceManagementManagedDevices.Read.All"The signed-in admin, limited by the consented scopes and their Intune role
App-only with a certificateConnect-MgGraph -ClientId <appId> -TenantId <tenantId> -CertificateThumbprint <thumbprint>The registered app, unattended, with its application permissions
App-only with a secretConnect-MgGraph -TenantId <tenantId> -ClientSecretCredential <credential>The registered app, unattended (the credential holds the client ID and secret)
Managed identityConnect-MgGraph -IdentityThe system-assigned managed identity of the host running the script

Get-MgContext shows whether the session is delegated or app-only and which scopes it holds. Invoke-MgGraphRequest sends any REST method to any Graph URI, which covers endpoints that have no cmdlet yet.

Guardrails that follow you into code. Using Graph still requires the Intune service to be correctly licensed. Multi Admin Approval (Phase 2) applies to Graph automation too, as of June 22, 2026: a call against a protected resource without the required approval headers gets HTTP 403, and you can exempt specific apps that use app-auth tokens on the access policy's Exclusions tab. And don't mix the Intune Graph APIs with the Windows Update for Business deployment service APIs for updates; each can overwrite the other's configuration. For the Monday export itself, Graph's deviceManagement/reports/exportJobs endpoint is the tool, covered in 6.2.1.

⚠️ Exam Trap: When a script that worked last year now gets a 403, look at what changed around it, not at the code. Two 2025–2026 changes produce exactly this: script endpoints now need DeviceManagementScripts permissions, and Multi Admin Approval now blocks Graph writes to protected resources unless the request is approved or the app is excluded.

Reflection Question: An unattended nightly job retires stale devices through Graph. It worked until your team created a Multi Admin Approval policy for device actions. Why does it fail now, and what are your two options to make it work again without removing the approval policy?

See how it connects
Alvin Varughese
Written byAlvin Varughese
Founder•26 professional certifications earned