PowerShell Microsoft Graph 11 min read

PowerShell Intune Reporting Without Brittle Exports

Useful reporting starts with a question, a stable data contract, and a process that handles pagination and throttling as normal conditions.

Define the report contract

Document the entities, fields, time window, and freshness requirement before writing the request. A report that returns every available property is expensive to operate and difficult to interpret.

Handle Graph as a service

Use least privilege, follow next links, and back off after throttling. Store only the fields needed for the decision. Keep authentication and query logic separate so both can be tested.

$uri = 'https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?$select=deviceName,complianceState,lastSyncDateTime'
$rows = @()
do {
  $response = Invoke-MgGraphRequest -Method GET -Uri $uri
  $rows += $response.value
  $uri = $response.'@odata.nextLink'
} while ($uri)

Make the output operational

Emit CSV for analysis and a small summary for humans. Include collection time, tenant, query version, and failure counts so a stale report cannot be mistaken for current health.

Operational checklist

  • Use a documented field contract.
  • Handle pagination and throttling.
  • Record collection metadata.
  • Keep credentials out of scripts and logs.

Read more

Technical Discussion & Q&A

Secure PostgreSQL Board

Join the Engineering Discussion

Loading discussion threads...

Akash Nagapure

Akash Nagapure

Microsoft Intune and VMware Architect

Microsoft Intune and VMware Architect specialized in designing scalable cloud infrastructure and zero-trust modern workspace solutions.

Enterprise Homelab
Sponsored

Enterprise Lab Blueprints Pro

Accelerate your cloud architecture transitions with ready-to-deploy Intune policies, configuration baselines, and automated scripts.

Was this guide helpful?

Loading community feedback...