Automate Intune management tasks
PowerShell and Microsoft Graph for Intune, Security Copilot agents in Intune, and custom compliance with PowerShell.
- 15 min
- 5 concepts
- Try it yourself
- 4-question check
Learn
Everything in the Intune admin center is a Microsoft Graph call underneath, so it can be scripted. Security Copilot agents add AI that watches your estate and recommends actions for you to approve.
- 1
Automate Intune management tasks by using PowerShell and Microsoft Graph
Use the Microsoft Graph PowerShell SDK (
Connect-MgGraph -Scopes DeviceManagementManagedDevices.ReadWrite.All, then cmdlets such asGet-MgDeviceManagementManagedDevice) or call Graph REST at/deviceManagement. For unattended automation, use an app registration with a certificate, or a managed identity in Azure Automation, with only the permissions needed. Graph Explorer helps discover calls.Remember: Admin center actions are Graph calls you can script.
- 2
Investigate threats identified by Security Copilot agents in Intune
The Vulnerability Remediation Agent uses Defender data to find vulnerabilities on managed devices, prioritise them by risk, and suggest Intune remediation steps such as an app update or a configuration change. Review its findings and reasoning before acting.
Remember: Vulnerability Remediation Agent: prioritised fixes from Defender data.
- 3
Analyze device performance by using Security Copilot agents in Intune
Copilot in Intune can summarise and explore device data in natural language: device details, compliance, apps and hardware. Agents such as the Device Offboarding Agent find stale or misaligned devices across Intune and Entra ID. Combine with Endpoint analytics for performance scores.
Remember: Ask Copilot about a device in plain English.
- 4
Review and respond to Security Copilot agent recommendations to make management decisions
Agents recommend, admins decide. The Change Review Agent evaluates multi admin approval requests and recommends approve or reject. The Policy Configuration Agent turns documents or plain-language requirements into settings catalog values. The Device Offboarding Agent requires admin approval before offboarding. Agents use Security Compute Units and need Security Copilot enabled.
Remember: Agents need approval; they don't act alone.
- 5
Extend device compliance by using PowerShell
Custom compliance for Windows uses a PowerShell discovery script that returns JSON values from the device, and a JSON rules file that defines expected values (with operators and remediation text) in the compliance policy. Use it for checks built-in compliance doesn't cover, such as a specific agent running.
Remember: Discovery script + JSON rules = custom compliance.
Security Copilot agents in Intune
| Agent | What it does |
|---|---|
| Vulnerability Remediation | Prioritises vulnerabilities from Defender data and suggests fixes |
| Change Review | Evaluates approval requests and recommends actions |
| Policy Configuration | Turns requirements into settings catalog values |
| Device Offboarding | Finds stale devices; offboards only with approval |
Try it
Click each line of this Graph PowerShell script that lists noncompliant Windows devices.
This interactive part needs JavaScript.
In the portal
- Custom compliance scriptsIntune admin center: Devices > Compliance > Scripts
- AgentsIntune admin center: Agents
- Graph ExplorerIntune admin center: developer.microsoft.com/graph/graph-explorer
Key terms
Click a card to see the definition.
Check your understanding
4 questions. Score 80% or more and these skills are marked as confident in your MD-102 study plan.
What two parts make up Windows custom compliance?
The script reports values; the JSON defines rules.
Which agent evaluates multi admin approval requests?
It recommends approve or reject.
What does Connect-MgGraph -Scopes do?
Scopes are the permissions consented for the session.
Do Intune agents offboard devices without asking?
The Device Offboarding Agent needs approval.
Sources
- Microsoft Learn: Working with Intune in Microsoft Graph
- Microsoft Learn: Security Copilot agents in Intune
- Microsoft Learn: Custom compliance settings for Windows
- Microsoft Learn: Microsoft Copilot in Intune
Facts in this lesson are from Microsoft Learn. This site isn't affiliated with Microsoft.