Skip to content
Microsoft Graph

Getting started with Microsoft Graph for Intune

Microsoft Graph turns repetitive portal work into a few lines of PowerShell. The hard part is not the code, it is choosing the right permissions and understanding what the data actually represents.

By Simon Hoque

Publication date
10 August 2026
Last updated
Updated 10 August 2026
Estimated reading time
8 min read

Install the module and sign in

Install-Module Microsoft.Graph -Scope CurrentUser # Request the smallest scope that answers your questionConnect-MgGraph -Scopes "DeviceManagementManagedDevices.Read.All"Get-MgContext | Select-Object Account, TenantId, Scopes
Illustrative example: connect with a read-only scope.

Your first device query

$devices = Get-MgDeviceManagementManagedDevice -All $devices |    Where-Object { $_.OperatingSystem -eq "Windows" } |    Select-Object DeviceName, ComplianceState, OsVersion, LastSyncDateTime |    Sort-Object LastSyncDateTime -Descending |    Select-Object -First 20
Illustrative example, not a production-ready script.

v1.0 versus beta

A number of Intune properties only exist in the beta endpoint. Beta is useful for exploration but can change without notice, so pin production automation to v1.0 wherever the data exists there.

EndpointUse forStability
v1.0Automation you depend onStable
betaExploration and new propertiesMay change

Where to go next

Once reading works, wrap your query in a function, output structured objects rather than formatted text, and only then think about scheduling it as unattended automation with app-only authentication.

Microsoft documentation

Found an error or have a better approach? Report it or suggest an improvement

Troubleshooting

Troubleshooting Win32 app deployments

A repeatable order of investigation for Win32 apps that report failure, stay stuck at pending, or install without appearing installed.

Publication date
10 August 2026
Last updated
Updated 10 August 2026
Estimated reading time
7 min read
Read article