Skip to content

fix(intune): explain unhealthy MTD connector states - #2736

Merged
merill merged 3 commits into
maester365:mainfrom
FiraSenax:fix/mt1098-connector-diagnostics
Nov 9, 2026
Merged

merill merged 3 commits into
maester365:mainfrom
FiraSenax:fix/mt1098-connector-diagnostics

Conversation

@FiraSenax

@FiraSenax FiraSenax commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

MT.1098 currently reports only a raw connector state and heartbeat, leaving a year-1 timestamp looking like an unexplained synchronization failure. Add per-connector reasons and remediation guidance, display year-1 or missing heartbeats as Never received, and escape connector values in the Markdown table.

Keep the enabled-state requirement and existing heartbeat window (less than 48 hours). A null heartbeat now produces a failing health result instead of a date-conversion error.

Related #2595. This addresses diagnosis of the existing health verdict; it does not mark notSetUp as healthy.

Validation:

  • 21 offline tests passed: documented and unknown states, missing/year-1/stale heartbeats, 47/48-hour boundary, multiple connectors, Markdown escaping, Graph errors, and Failed/Skipped/Error rows through Invoke-MtTest.
  • The original implementation fails the new explanation and missing-heartbeat regression cases.
  • Module build, packaged-module validation, native metadata validation, and ScriptAnalyzer checks passed.
  • Ran all 187 unit-test files (8,361 tests). The initial run recorded three host-dependent failures: macOS hidden-file attributes in AgentFiles, terminal capability detection in ConsoleOutput, and a temporary-directory catalog fixture. All three passed in isolated reruns; the catalog case also passed on unchanged main and the fixed implementation in clean temporary checkouts.

Live tenant validation on 2026-11-09 (PowerShell 7.5.2, Microsoft Graph Authentication 2.41.2):

  • The real beta/deviceManagement/mobileThreatDefenseConnectors endpoint initially returned zero connectors. The real check through Invoke-MtTest -Id MT.1098 returned Skipped / TestSkipped with No Mobile Threat Defense Connectors found.
  • Created a temporary connector using the ID currently mapped to Windows Security Center by this check with all device/MAM platform switches disabled. The service returned partnerState = notSetUp and a year-1 heartbeat.
  • Executed the real changed check through the native engine, without mocked Graph responses. It returned Failed; the report showed Never received, the incomplete-setup explanation, and No heartbeat has been received with remediation guidance.
  • Deleted the connector and verified that the live connector inventory was empty again. The final inventory check found no remaining test fixtures.

Live coverage is the empty inventory and notSetUp/year-1 heartbeat case. Other connector states, null/stale heartbeats, and the 47/48-hour boundary remain covered by the 21 offline tests above. The existing vendor-ID mapping is unchanged; this passive fixture does not independently verify vendor identity mappings.

After removing two unused mock parameters reported by code scanning, reran the 21 connector tests through powershell/tests/pester.ps1 (all passed) and PSReviewUnusedParameter (zero findings). The production check is unchanged from the live-tested implementation.

Connector-state meanings follow Microsoft's documentation.

GitHub-hosted CI for the updated head currently reports action_required; no jobs have executed yet. Workflow status.

Summary by CodeRabbit

  • New Features
    • Connector health results show each connector’s state, heartbeat, and an explanation. Missing heartbeats are identified as never received, while stale heartbeats include an explanation.
  • Bug Fixes
    • A connector is reported as healthy only when it is enabled and its heartbeat is less than 48 hours old.
  • Documentation
    • Updated guidance explains connector states, heartbeat criteria, and remediation steps for unhealthy or unresponsive connectors.

@FiraSenax
FiraSenax requested review from a team as code owners November 8, 2026 20:56
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Walkthrough

MT.1098 now reports connector state, heartbeat, and reasons, including missing or stale heartbeats. Its documentation describes health criteria and remediation. New Pester tests cover connector outcomes and engine classifications.

Changes: Connector health reporting

Layer / File(s) Summary
Connector health details and guidance
tests/maester/intune/Test.MT.1098.ps1, tests/maester/intune/Test.MT.1098.md
The test adds connector-specific reasons and displays missing heartbeats as “Never received.” The documentation describes health criteria, connector states, remediation, and an updated reference link.
Connector and engine test coverage
powershell/tests/functions/Test-MtMobileThreatDefenseConnectors.Tests.ps1
New Pester tests cover connector state and heartbeat results, reporting and escaping, empty connector responses, Graph errors, and engine classifications.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related issues

Suggested labels: product: intune

Suggested reviewers: merill, samerde

Merge Risk: Minimal · up to f41e6

Connector health results now explain unhealthy states and missing heartbeats. No merge-blocking issue was identified, subject to normal CI checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(intune): explain unhealthy MTD connector states" matches the main change. The PR adds per-connector reasons and remediation guidance to MT.1098, shows missing or year-1 heartbeats as "N…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description covers the required substance of the change. It states the problem (MT.1098 shows only a raw connector state and heartbeat), the changes (per-connector reasons, remediation guidance, N…
Full details: Title check

Explanation

The title "fix(intune): explain unhealthy MTD connector states" matches the main change. The PR adds per-connector reasons and remediation guidance to MT.1098, shows missing or year-1 heartbeats as "Never received", and escapes Markdown table values. The title is specific and uses the conventional prefix. It does not mention the null-heartbeat fix, but that is a secondary point.

Full details: Description check

Explanation

The description covers the required substance of the change. It states the problem (MT.1098 shows only a raw connector state and heartbeat), the changes (per-connector reasons, remediation guidance, Never received display for year-1 or missing heartbeats, Markdown escaping), and the null-heartbeat fix. It also gives detailed validation: offline tests, a live tenant run, and a code-scanning follow-up. The template's Description section is filled in. The template's Checks boxes are not ticked, and the linked issue is referenced as 'Related #2595' rather than in the template's 'Closes #' form. The Code freeze notice applies to new features and tests, and this PR is framed as a fix, so it does not block the check. Those gaps are minor and do not make the description incomplete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ef238a6 and 3134b71.

Files selected for processing: 1

  • powershell/tests/functions/Test-MtMobileThreatDefenseConnectors.Tests.ps1

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the Intune connector-health diagnostic improvements.

No open issues 🎉

What changed in this PR

This PR improves diagnostics for Maester’s MT.1098 Intune connector health check without relaxing its enabled-state requirement or existing heartbeat window. It addresses the diagnostic aspect of #2595; notSetUp remains unhealthy.

Changes:

  • Adds per-connector reasons and remediation guidance, with escaped connector values in the Markdown table.
  • Displays missing or year-1 heartbeats as Never received, returning an unhealthy result rather than a null-date conversion error.
  • Adds regression coverage for connector states, heartbeat boundaries, Markdown escaping, and native-engine outcomes.
File Description
tests/​maester/​intune/​Test.MT.1098.ps1 Adds state explanations, missing-heartbeat handling, and safe table formatting.
tests/​maester/​intune/​Test.MT.1098.md Clarifies health criteria, connector states, and remediation steps.
powershell/​tests/​functions/​Test-MtMobileThreatDefenseConnectors.Tests.ps1 Adds diagnostic, boundary, escaping, and engine-result tests.

Review effort: Balanced

Mock -ModuleName Maester Get-Date { [datetime]'2026-11-08T12:00:00Z' }
Mock -ModuleName Maester Invoke-MtGraphRequest { $script:Connector }
Mock -ModuleName Maester Add-MtTestResultDetail {
param($Result, $SkippedBecause, $SkippedCustomReason)
Mock -ModuleName Maester Get-Date { [datetime]'2026-11-08T12:00:00Z' }
Mock -ModuleName Maester Invoke-MtGraphRequest { $script:Connector }
Mock -ModuleName Maester Add-MtTestResultDetail {
param($Result, $SkippedBecause, $SkippedCustomReason)
@julien-ly

Copy link
Copy Markdown
Contributor

The ID table, which this PR keeps as is, has two entries worth checking:

  • Trellix Mobile Security, 4873197-ffec-4dfc-9816-db65f34c7cb9, has seven hex characters in its first block, so it can't match a connector ID. Microsoft365DSC carries the same value.
  • Windows Security Center is c2b688fe-48c0-464b-a89c-67041aa8fcb2 here and e6f777f8-e4c2-4a5b-be01-50b5c124bc7f in Microsoft365DSC.

FiraSenax and others added 2 commits November 9, 2026 02:50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Entire-Checkpoint: 01M6ZQ3XFATYYQTYJ0NQN6VJVT

@merill merill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @FiraSenax

@merill
merill merged commit 986862d into maester365:main Nov 9, 2026
4 of 5 checks passed
@merill

merill commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Thanks @julien-ly, both checked.

@FiraSenax
FiraSenax deleted the fix/mt1098-connector-diagnostics branch November 9, 2026 22:43
@julien-ly

Copy link
Copy Markdown
Contributor

@merill Follow-up on your Windows Security Center question: Microsoft365DSC has replaced e6f777f8-… with c2b688fe-48c0-464b-a89c-67041aa8fcb2 and fixed the Trellix ID in Microsoft365DSC/Microsoft365DSC#7611 (merged into Dev today, not released yet). I had reported both in Microsoft365DSC/Microsoft365DSC#7609 with the IDs Graph returned in my lab tenant. The DSC resource that #2755 points the MT.1098 source comment at now lists the same 16 connectors as MT.1098.

DSC also added iVerify, taken from MT.1098. I created an iVerify connector in the same tenant from the Intune admin center, without enabling anything, and Graph returned fc06ff9b-e2f9-4221-9a68-465684ee8662, the value both tables use. Nothing to change in MT.1098.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants