Skip to content

fix(intune): ask for a MAM enrolment on the Windows Security Center connector - #2794

Open
earbona23 wants to merge 3 commits into
maester365:mainfrom
earbona23:fix/mt1098-windows-security-center-mam
Open

earbona23 wants to merge 3 commits into
maester365:mainfrom
earbona23:fix/mt1098-windows-security-center-mam

Conversation

@earbona23

@earbona23 earbona23 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes the remaining part of #2595.

What is wrong today

MT.1098 reports a notSetUp connector with: "Setup is incomplete; device threat messages are blocked. Complete setup in Intune and with the partner, or remove an unused connector."

For the Windows Security Center connector that advice is wrong in a specific, reproducible case. @julien-ly measured it in a lab tenant (#2595): after turning on Connect Windows devices for MAM, windowsMobileApplicationManagementEnabled is true while partnerState stays notSetUp and lastHeartbeatDateTime stays 0001-01-01T00:00:00Z, unchanged over two days with no Windows device registered for MAM. The Intune admin center says so in the connector blade, quoted by @Mynster9361 in the issue: the status does not show Enabled until the first MAM user enrollment, and updates within 30 minutes of one.

So the operator is sent back to the partner to finish a setup that is already finished.

What this does not change

The verdict. Mobile Threat Defense integration with Intune documents notSetUp as blocking device threat messages since 2309, whatever the reason for the state. A connector in that state is not carrying the signal it exists to carry, and the remediation is real: enroll a MAM user, or remove a connector you are not going to use. Failed stays Failed.

If either of you reads this case as something that should pass, say so and I will change it instead — that is the one part of this where I am taking a position rather than reporting a measurement.

One thing worth flagging

Two Microsoft pages disagree about this connector, which is probably why the issue was confusing to begin with:

source says
threat-defense-step-3 (one revision) status is Available after creation, Enabled when the MAM toggle goes on
threat-defense-step-3 (another revision) status stays Unavailable until the first app protection policy or MAM enrollment
Intune admin center, and the tenant notSetUp until the first MAM user enrollment

Neither page matches what the API returns. This PR follows the tenant.

The change

  • Reason for notSetUp, only when the connector ID is the Windows Security Center one and its own Windows MAM toggle is on: ask for the enrollment, and say the block is in force until then.
  • The heartbeat line in the same case says no heartbeat arrives before that enrollment, instead of telling the operator to check partner connectivity.
  • Both conditions are required, so a connector with the toggle off, or another connector with a Windows MAM toggle on, still gets the generic explanation. Two negative cases assert exactly that.
  • Test.MT.1098.md documents the case.

Verification

Run through powershell/tests/pester.ps1, so on the Pester the repository pins (5.7.1), not whatever is newest on the machine:

Test-MtMobileThreatDefenseConnectors.Tests.ps1    26 passed, 0 failed   (22 before, all kept)
AttributeReview.Tests.ps1                         35 passed
GeneratedFileFormatting.Tests.ps1                  3 passed
PSScriptAnalyzer.Tests.ps1                      1708 passed

The tests are not passing for free: disabling the new condition fails exactly the two cases that assert the new reason, the focused one and the engine one, and nothing else.

Credit where it is due — @Mynster9361 found it and @julien-ly measured it, so I added both to Contributor along with @FiraSenax, whose #2736 put the Reason column there in the first place.

Summary by CodeRabbit

  • Bug Fixes
    • Windows Security Center checks now clarify that the first Windows MAM user must enrol when MAM is enabled and the connector is not set up. The check remains failed until enrolment, and the message retains relevant missing-heartbeat details.
    • Other connectors and cases where MAM is off retain their existing setup guidance.
    • Checks also report the enrolment requirement when the connector has not sent a heartbeat.
  • Documentation
    • Updated the check guidance to explain the Windows MAM enrolment requirement and the expected status before enrolment.

…onnector

MT.1098 tells the operator to complete setup in Intune and with the partner
whenever a connector reports `notSetUp`. For the Windows Security Center
connector with **Connect Windows devices for MAM** already on, that setup is
done: Intune keeps the state at `notSetUp`, and sends no heartbeat, until the
first Windows MAM user enrols (maester365#2595, measured on a lab tenant).

The verdict does not move. Microsoft documents `notSetUp` as blocking device
threat messages whatever the cause, so the connector is still not carrying the
signal it exists to carry. What changes is the Reason column and the heartbeat
line, so the row names what is actually missing.

Both guards are anchored: the connector's own ID and its own toggle. Either one
alone keeps the generic explanation, which the two new negative cases assert.
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

MT.1098 now gives the Windows Security Center connector an enrolment-specific reason when Windows MAM is enabled and its state is notSetUp. Tests check the heartbeat detail, fallback reasons, and engine-level result.

Changes: Windows MAM enrolment handling

Layer / File(s) Summary
Select the enrolment-specific reason
tests/maester/intune/Test.MT.1098.ps1, tests/maester/intune/Test.MT.1098.md
When Windows MAM is enabled for Windows Security Center and the partner state is notSetUp, MT.1098 gives a reason that requests first-user enrolment. The missing-heartbeat reason identifies that enrolment has not occurred. The documentation describes this case.
Verify the reason and fallback cases
powershell/tests/functions/Test-MtMobileThreatDefenseConnectors.Tests.ps1
Tests check the enrolment-specific reason and blocked-threat-messages detail, the generic reason when MAM is off or enabled on a different connector, and the engine-level failed result with the missing-heartbeat detail.

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

Change: Bug fix

Suggested reviewers: firasenax

Merge Risk: Minimal · up to 30177

This change only improves the explanation shown when Windows Security Center is waiting for its first Windows MAM enrolment. The pass/fail result is unchanged, so the risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding a MAM enrolment request to the Windows Security Center connector's notSetUp reason in the Intune MT.1098 check. It uses the conventional fix(intune) prefix and …
Description check Passed The description follows the repository template closely. It has a clear problem statement, a linked issue (#2595, though the 'Closes' line is phrased as the remaining part of that issue), an explanati…
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.
Full details: Title check

Explanation

The title names the main change: adding a MAM enrolment request to the Windows Security Center connector's notSetUp reason in the Intune MT.1098 check. It uses the conventional fix(intune) prefix and is specific about the affected connector. The changeset matches this summary: the reason and heartbeat text change only when the connector is Windows Security Center and its Windows MAM toggle is on, with tests and docs to match.

Full details: Description check

Explanation

The description follows the repository template closely. It has a clear problem statement, a linked issue (#2595, though the 'Closes' line is phrased as the remaining part of that issue), an explanation of the behavior change and what stays unchanged, and verification details from running pester.ps1. Template checkboxes are unticked, and the 'Closes # <Issue #>' placeholder was replaced with a textual reference rather than a formal issue link. The description also covers the Maester 3.0 code freeze context only implicitly. These are minor gaps, not missing core content.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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 a44fac0 and 30177c3.

Files selected for processing: 2

  • tests/maester/intune/Test.MT.1098.md
  • tests/maester/intune/Test.MT.1098.ps1
Files skipped from review as they are similar to previous changes: 2

  • tests/maester/intune/Test.MT.1098.md
  • tests/maester/intune/Test.MT.1098.ps1

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 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.

@julien-ly

Copy link
Copy Markdown
Contributor

Ran MT.1098 from this branch (690ecda) against the tenant from #2595, November 11, 15:30 UTC:

Name LastHeartbeatDateTime PartnerState Reason
Trellix Mobile Security Never received notSetUp Setup is incomplete; device threat messages are blocked. Complete setup in Intune and with the partner, or remove an unused connector. No heartbeat has been received. Complete setup and verify that the partner can communicate with Intune.
Windows Security Center Never received notSetUp Windows MAM is on and this connector stays in notSetUp until the first Windows MAM user enrols; device threat messages are blocked until then. Enrol a MAM user, or remove the connector if Windows MAM is not in use. No heartbeat arrives before that first enrolment.
iVerify Never received notSetUp Setup is incomplete; device threat messages are blocked. Complete setup in Intune and with the partner, or remove an unused connector. No heartbeat has been received. Complete setup and verify that the partner can communicate with Intune.

Result: Failed. On live data, the Windows Security Center connector gets the new reason, and the two other notSetUp connectors keep the generic one.

It's the same Windows Security Center connector as in #2595, still notSetUp with no heartbeat, so the window with the toggle on is now nearly two days. It went on in the evening of November 9; the reading I posted in #2595 covered about 24 hours.

The ubuntu build-validation failure isn't from this PR. The File encoding failure is powershell/tests/functions/Invoke-MtPackGitHubRequest.Tests.ps1, which has had no byte order mark on main since #2792 (this PR's three files keep theirs). The other three are in Test-MtCaEmergencyAccessExists.Tests.ps1, last changed by #2758. The same job fails on other PRs opened today.

Two small things, your call:

  • Test.MT.1098.md calls this "a documented special case". The only source for the enrollment trigger is the note in the Intune admin center, and the live threat-defense-step-3 page says the opposite (Available after creation, Enabled when the toggle goes on). Maybe "a special case noted in the Intune admin center".
  • The Reason starts with "Windows MAM is on", but what the test reads is the connector's own Connect Windows devices for MAM toggle, which doesn't tell whether a Windows app protection policy is deployed.

Thanks for the credit.

@earbona23

Copy link
Copy Markdown
Contributor Author

Thank you @julien-ly — that is the measurement I could not take, and it lands exactly where the guard aims.

Two things your table shows beyond "the text changed":

  • Windows Security Center gets the new Reason, and Trellix and iVerify keep the original one. That is the guard being narrow on purpose: it only fires for the Windows Security Center connector id when windowsMobileApplicationManagementEnabled is true and the state is notSetUp. A connector that is genuinely half-configured still sends the operator back to the partner.
  • All three stay failures. The verdict never moved — Microsoft documents notSetUp as blocking device threat messages whatever the cause. What changed is that the Windows row no longer asks for setup work that is already done.

So the row now names the one action that resolves it: enrol a Windows MAM user, or remove the connector if Windows MAM is not in use.

@julien-ly

Copy link
Copy Markdown
Contributor

Measured the transition on the same lab tenant today, with the tenant's first Windows MAM enrolment (main 2d659e8, this PR at a44fac0).

Before (MT.1098 at 20:31 UTC): Windows Security Center notSetUp, no heartbeat, windowsMobileApplicationManagementEnabled true. main gives the generic reason; this PR gives "Windows MAM is on and this connector stays in notSetUp until the first Windows MAM user enrols…". Trellix and iVerify, also notSetUp, keep the generic reason on both.

Enrolment on an unmanaged Windows 11 device with Edge 157, for a test user targeted by a Windows app protection policy and by a Conditional Access policy that requires an app protection policy or a compliant device. Times in UTC, read from Graph every two minutes:

  • 20:46:24: the device is registered (Workplace) for the test user.
  • 20:46:38: the Windows MAM registration for Edge appears in managedAppRegistrations.
  • 20:46:45: the connector's lastHeartbeatDateTime. The read at 20:45:10 still showed notSetUp; the one at 20:47:11 showed enabled.

So the first heartbeat came seven seconds after the first enrolment, well inside the 30 minutes the admin center mentions (one tenant, one enrolment).

After (MT.1098 at 21:01 UTC): the Windows Security Center row is identical on main and on this PR: enabled, heartbeat 20:46:45, "Enabled with a recent heartbeat." MT.1098 still fails on both because of Trellix and iVerify, as expected.

That matches the case the PR describes: notSetUp with the Windows MAM toggle on means nobody has enrolled yet, and it clears by itself with the first enrolment. The new reason text promises no delay, so nothing to change there.

…d" claim

Two corrections to the Windows Security Center case, both about claiming more
than the source supports.

The guide called it "a documented special case". The live Learn page for the
connector says the opposite - Available after creation, Enabled once the toggle
goes on - and the only source for the enrolment trigger is the note in the
Intune admin center. It now says "a special case noted in the Intune admin
center".

The Reason opened with "Windows MAM is on". What the check reads is the
connector's own windowsMobileApplicationManagementEnabled, the Connect Windows
devices for MAM toggle, which says nothing about whether a Windows app
protection policy is deployed. The Reason now names that toggle.

No behaviour change: the guard, the verdict and the heartbeat line are
untouched, and the unit tests match on "first Windows MAM user enrols", which
both wordings keep.
@earbona23

Copy link
Copy Markdown
Contributor Author

Thank you @julien-ly — that is the half of the case I could not reach. The branch asserts that notSetUp with the toggle on clears by itself on the first enrolment, and until now the only evidence was the state before. Seven seconds between the Edge registration appearing in managedAppRegistrations and the connector's lastHeartbeatDateTime, read two minutes either side, closes it. It also settles the wording question I had left open: the Reason promises no delay, so there is nothing to soften.

Your two points from the earlier review are in 30177c3b:

What you raised Where it is
Test.MT.1098.md calls this "a documented special case", but the live threat-defense-step-3 page says the opposite and the only source is the admin center note The guide now reads "a special case noted in the Intune admin center". Your wording, unchanged
The Reason opens with "Windows MAM is on", but the check reads the connector's own Connect Windows devices for MAM toggle, which says nothing about a deployed app protection policy The Reason now opens with "Connect Windows devices for MAM is on for this connector, so it stays in notSetUp until…"

Both are the same mistake on my part — claiming more than the field or the source supports — and neither changes behaviour. The guard, the verdict and the heartbeat line are untouched; the unit tests match on "first Windows MAM user enrols", which both wordings keep. 26 of 26 pass here through powershell/tests/pester.ps1, along with TestAttributes (171) and AttributeReview (35).

On the Linux leg, your reading matches mine exactly, down to the file names. The byte order mark is #2795 and the three Test-MtCaEmergencyAccessExists cases are #2797 — in that one the runner's own $config resolves up the scope chain into the five cases that pass $config meaning "nothing supplied", which is why it bites only where coverage is on. Both are still open, and main stays red for every PR until they go in.

This branch has not been deployed

No deployments
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.

2 participants