MSBA-219 · Lesson 7 of 12 · 19 min
Domain review: automation, monitoring and reporting
▶ Video coming soon A video version of this lesson is on the way.
The fifth domain was the one Ama knew least, and the one most candidates know least, because it only arrived in July 2026. Its full name is Optimize endpoint operations by using automation, monitoring, and reporting, and it is worth 10 to 15 percent. "It is the smallest," Ama said. "It is also the one where an evening of study changes your score most," Ines replied. The domain has two groups: automating management tasks, and monitoring and optimizing health. MSBA-211 lessons 9 to 11 and MSBA-212 lessons 8 and 10 taught most of it.
Automating Intune with PowerShell and Microsoft Graph
Everything in the Intune admin center is built on **Microsoft Graph**. Scripts use the **Microsoft Graph PowerShell SDK**, which replaced the retired MSOnline and AzureAD modules and the older Intune PowerShell SDK. A script connects with `Connect-MgGraph`, asks for the permission **scopes** it needs, and calls cmdlets such as `Get-MgDeviceManagementManagedDevice`. Unattended automation uses an app registration with application permissions and a certificate rather than a user's sign-in.
Connect-MgGraph -Scopes "DeviceManagementManagedDevices.Read.All"
Get-MgDeviceManagementManagedDevice -All |
Where-Object { $_.ComplianceState -eq "noncompliant" } |
Select-Object DeviceName, UserPrincipalName, OperatingSystem, LastSyncDateTimeThe exam is unlikely to ask you to write a script, but it does ask which tool fits, which permission a task needs and why a script fails. **Least privilege** is the theme: a report that only reads devices needs a `.Read.All` scope, not `.ReadWrite.All`. A script that works for an administrator and fails for an automation account usually lacks admin consent for the application permission. Corvallin's nightly report of devices that had not synced in 14 days ran as an app registration with read-only device permissions and a certificate stored in a key vault.
Extending compliance with PowerShell
Custom compliance extends Windows compliance policies with checks that built-in rules do not cover. It has two parts. A discovery script, written in PowerShell and uploaded to Intune, runs on the device and returns a compact JSON object of values. A JSON rules file, attached to the compliance policy, states the expected value for each setting, the operator, and the message the user sees if the device fails. MSBA-211 used it to check that a required line-of-business agent was installed and running.
$svc = Get-Service -Name "VisitWiseSync" -ErrorAction SilentlyContinue
$hash = @{ VisitWiseSyncRunning = ($null -ne $svc -and $svc.Status -eq "Running") }
return $hash | ConvertTo-Json -CompressSecurity Copilot agents in Intune
Three objectives name Security Copilot agents in Intune: investigating threats they identify, analyzing device performance with them, and reviewing and responding to their recommendations. Microsoft has introduced several such agents since 2025, for example to prioritize vulnerability remediation or to review policy changes, and their names and availability have changed during 2026. For the exam, focus on the pattern rather than the names. An agent analyzes Intune and Defender data, produces findings and recommendations, and an administrator reviews them and decides. Agents act within the permissions of the identity they run as, their activity is logged, and Security Copilot capacity is consumed when they run.
| Agent task in the outline | What the administrator does | What to remember |
|---|---|---|
| Investigate threats identified by agents | Open the agent's finding, check the affected devices and evidence, decide on remediation | The agent suggests; the administrator verifies and acts |
| Analyze device performance | Use agent summaries of Endpoint analytics data to find slow devices or failing apps | Same data as Endpoint analytics, presented with explanations |
| Respond to recommendations | Approve, adjust or reject a suggested change such as a policy update | Changes still follow RBAC and, where configured, multi-admin approval |
Corvallin does not license Security Copilot; MSBA-203 noted that its inclusion is tied to Microsoft 365 E5 and E7. Ama studied this area from Microsoft Learn modules and documentation, and treated it as a reading topic: what agents do, what the administrator must still check, and how licensing and capacity work.
Reporting and data visibility
Intune reports are grouped into operational reports for day-to-day work, organizational reports for summaries, historical reports for trends and specialist reports such as Endpoint analytics. The outline asks you to customize reports and filters, use workbooks and dashboards, and export data. Reports can be filtered, sorted and exported to CSV from the admin center, or exported through Graph. For long-term analysis, diagnostic settings send Intune audit and operational logs to a Log Analytics workspace, where workbooks and KQL queries give dashboards beyond what the admin center keeps.
Endpoint analytics and Remediations
Endpoint analytics scores devices on startup performance, application reliability, restart frequency and other measures, and compares them with baselines and with similar organizations. A low startup score points at slow boot or sign-in, often caused by startup apps or group policy processing; a low app reliability score points at apps that crash or hang. Ama used it during the Windows 11 rollout to find nine laptops with a fingerprint driver problem.
Remediations are pairs of PowerShell scripts. A detection script checks for a problem and exits with code 1 if it finds one; a remediation script then fixes it. Each pair is scheduled, for example once a day or every hour, and its results appear in reports. Remediations need Windows Enterprise or Education licensing through Microsoft 365 E3 or E5 or equivalents. Corvallin used one to remove PrintAssist from laptops where uninstalling through the app failed.
Tenant health and alerts
The last objectives cover service health and alerts. Service health and the message center in the Microsoft 365 admin center, also shown in the Intune admin center's tenant administration area, report incidents, advisories and planned changes; the outline asks you to review them and build operational baselines, so you know what normal looks like before something changes. Alerts for compliance drift, enrollment failures and configuration conflicts can be built from Intune's own notifications and reports, or from Log Analytics queries with alert rules in Azure Monitor that email or post to Teams when a threshold is crossed.
Worked problem
Alerting on enrollment failures
Ines wants an email whenever more than ten Autopilot enrolments fail in a day, so that a vendor registration problem is caught early. Which approach fits?
Show solution
- Send Intune operational logs to a Log Analytics workspace through diagnostic settings.
- Write a KQL query that counts failed enrollment events per day.
- Create an Azure Monitor alert rule on the query with a threshold of 10 and an action group that emails the IT team.
- Review the alert after the next rollout to tune the threshold.
Answer: Diagnostic settings to Log Analytics plus an Azure Monitor log alert. The admin center reports show failures, but alerting on a threshold needs a query-based alert.
Delegated or application permissions
Domain 5 expects you to choose how a script signs in. With delegated permissions, the script acts as a signed-in user and can do no more than that user is allowed; this suits interactive work at a console. With application permissions, the script acts as itself through an app registration, with no user present; this suits scheduled jobs. For unattended scripts, Microsoft recommends a certificate rather than a client secret, and the app should be granted only the permissions it needs, such as read-only access to managed devices for a reporting job. Teodor's stale-device report at Corvallin used exactly this pattern: an app registration, a certificate and read-only permission.
Connect-MgGraph -ClientId $appId -TenantId $tenantId -CertificateThumbprint $thumb
Get-MgDeviceManagementManagedDevice -All |
Where-Object { $_.LastSyncDateTime -lt (Get-Date).AddDays(-60) } |
Select-Object DeviceName, UserPrincipalName, LastSyncDateTimeLogs and alerts: where each one lives
The monitoring objectives are easy to mix up because several places show similar data. Intune's own reports show device, app, compliance and update status. Intune audit logs record who changed what in the console. Diagnostic settings send Intune log categories, such as audit logs, operational logs and device compliance logs, to a Log Analytics workspace, a storage account or an event hub for longer retention and custom queries. Service health in the Microsoft 365 admin center shows Microsoft-side incidents. Endpoint analytics scores startup performance, app reliability and other experience measures. Alerts that need custom conditions, such as more than five wipes in an hour, are built in Azure Monitor on the Log Analytics data.
Original practice questions for domain 5
| # | Question |
|---|---|
| 1 | A nightly script must export the device list without a user signed in, with least privilege. How should it authenticate? (A) An app registration with application permission to read managed devices and a certificate (B) A Global Administrator's password stored in the script (C) Delegated permissions with an interactive sign-in (D) The MSOnline module |
| 2 | Intune audit logs must be kept for two years and queried with KQL. What should you configure? (A) Diagnostic settings that send Intune logs to a Log Analytics workspace (B) A longer compliance grace period (C) Endpoint analytics (D) A Remediations script |
| 3 | An administrator must find out who changed a compliance policy yesterday. Where should she look first? (A) Intune audit logs (B) The device install status report (C) Service health (D) Endpoint analytics |
| 4 | A detection script finds a misconfigured registry value. Which exit code makes Intune run the remediation script? (A) 1 (B) 0 (C) 3010 (D) 1641 |
| 5 | Laptops at one branch start much more slowly than others. Which tool shows startup performance by device? (A) Endpoint analytics (B) Intune audit logs (C) Service health (D) The app protection report |
| 6 | A device must report noncompliant when a line-of-business app's cache folder is missing, a check no built-in setting offers. What should you build? (A) A custom compliance policy with a discovery script and a JSON rules file (B) A Remediations package only (C) An app configuration policy (D) A feature update policy |
| # | Answer | Why |
|---|---|---|
| 1 | A | Unattended jobs use application permissions; certificates are preferred over secrets; MSOnline is retired |
| 2 | A | Diagnostic settings export logs for retention and KQL queries |
| 3 | A | Audit logs record console changes and who made them |
| 4 | A | Exit 1 means the issue was found; 3010 and 1641 are installer return codes |
| 5 | A | Endpoint analytics includes startup performance scores |
| 6 | A | Custom compliance evaluates script output against JSON rules; Remediations fix but do not mark compliance |
Why this domain rewards hands-on time
Domain 5 is the smallest by weight, but it is the one where reading alone helps least. A script that connects to Graph, a detection script that returns the right exit code and a JSON rules file that matches the discovery script's output are all easy to describe and easy to get slightly wrong. Ama found that ten minutes of writing and running a small Remediations pair in the lab taught her more than an hour of reading about it, because the mistakes were her own: a detection script that wrote output but exited with 0, a rules file whose setting name did not match the script's property name, and a Graph connection that failed because she had asked for a permission the app registration had not been granted. Each of those mistakes is a plausible exam distractor.
The other half of the domain is choosing where to look. Most questions give you a symptom and ask which report, log or tool shows the cause. A useful habit is to ask whether the question is about a device, a change or Microsoft itself. Device state belongs to Intune reports and Endpoint analytics. A change made by an administrator belongs to audit logs. A problem on Microsoft's side belongs to service health.
How Ama reviewed this domain
Ama gave domain 5 more hours than its weight suggested, for two reasons: it was new, and her first practice assessment showed it as her weakest. She reviewed it in the lab rather than on paper. In one evening she created an app registration with read-only device permission and a certificate, connected with it, and listed devices. In another she wrote the Remediations pair from lesson 9 and a custom compliance check. In a third she sent the lab tenant's Intune logs to a Log Analytics workspace and wrote a short KQL query over the audit log. After those three evenings, the domain went from her weakest to one of her strongest.
One caution applies to all of this. Scripts that change devices, such as remediation scripts or Graph calls that wipe or retire, carry real risk in production. Corvallin put scripts and Remediations under multi-admin approval for that reason, and a question that asks how to stop a single administrator from deploying an untested script to every device is pointing at the same control.
Common mistakes
MistakeUsing the AzureAD or MSOnline PowerShell modules in automation.
InsteadBoth are retired; use the Microsoft Graph PowerShell SDK.
MistakeGranting ReadWrite permissions to a reporting script.
InsteadUse the least-privileged Read scope the task needs.
MistakeWriting custom compliance as a single script with no rules file.
InsteadCustom compliance needs a discovery script and a JSON rules file.
MistakeTreating Security Copilot agent recommendations as automatic changes.
InsteadThe administrator reviews, verifies and decides.
MistakeExpecting the admin center to keep logs forever.
InsteadSend logs to Log Analytics for long-term analysis and alerting.
Summary and key terms
- Domain 5 is new in 2026 and worth 10 to 15 percent; most candidates know it least.
- Automation uses the Microsoft Graph PowerShell SDK with least-privilege scopes or app permissions.
- Custom compliance pairs a PowerShell discovery script with a JSON rules file in a Windows compliance policy.
- Security Copilot agents analyze and recommend; administrators investigate, review and decide.
- Endpoint analytics scores startup and app reliability; Remediations run detection and remediation script pairs on a schedule.
- Diagnostic settings send logs to Log Analytics for workbooks, KQL and alert rules.
- Microsoft Graph PowerShell SDK
- The current PowerShell modules for automating Microsoft 365 and Intune through Microsoft Graph.
- Scope
- A Graph permission requested by a script, such as DeviceManagementManagedDevices.Read.All.
- Custom compliance
- Compliance rules defined by a discovery script and a JSON rules file.
- Endpoint analytics
- Intune reports that score device startup performance and app reliability.
- Remediations
- Scheduled pairs of detection and remediation scripts that find and fix problems.
- Diagnostic settings
- Configuration that sends Intune logs to Log Analytics, storage or an event hub.
Practice problems
Work each problem on paper first, then reveal the answer to check.
What exit code tells Remediations that the detection script found an issue?
Show answer
Exit code 1.
What two files make up a custom compliance check?
Show answer
A PowerShell discovery script and a JSON rules file.
Why send Intune logs to Log Analytics?
Show answer
For longer retention, KQL queries, workbooks and alert rules beyond what the admin center provides.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.