Skip to content

MT.1123: detect BitLocker configured via Settings catalog - #2144

Open
royklo wants to merge 1 commit into
maester365:mainfrom
royklo:fix/mt1123-bitlocker-settings-catalog
Open

MT.1123: detect BitLocker configured via Settings catalog#2144
royklo wants to merge 1 commit into
maester365:mainfrom
royklo:fix/mt1123-bitlocker-settings-catalog

Conversation

@royklo

@royklo royklo commented Aug 22, 2026

Copy link
Copy Markdown

Same root cause as #2143, different test.

Problem

Test-MtBitLockerFullDiskEncryption filters policies on templateReference/templateFamily eq 'endpointSecurityDiskEncryption', which only matches profiles created under Endpoint security > Disk encryption.

Every device_vendor_msft_bitlocker_* setting definition is published with visibility: "settingsCatalog,template" — including the four this test reads (systemdrivesencryptiontype, fixeddrivesencryptiontype, requiredeviceencryption, encryptionmethodbydrivetype). BitLocker configured through Devices > Configuration > Settings catalog therefore lands on templateFamily: "none" and is invisible to the test.

Verified against a tenant holding a CIS (BL) BitLocker - Windows 11 Intune 5.0.0 settings-catalog policy with 7 BitLocker settings configured. MT.1123 reported:

No Endpoint Security Disk Encryption policies found in Intune. Create a Disk Encryption policy under Endpoint Security > Disk Encryption

That policy exists. It just has Used Space Only on OS drives — so the check still fails, but for the wrong reason and with remediation advice that sends the admin to create a duplicate policy instead of changing one dropdown in the one they have. In any tenant where a settings-catalog BitLocker policy does set Full encryption, it's a straight false negative.

Related: Personal Data Encryption profiles also carry the endpointSecurityDiskEncryption family, so they counted towards the Disk Encryption policy total despite configuring no BitLocker settings.

Fix

  • Query Windows configuration policies ($filter=platforms has 'windows10') and identify BitLocker policies by the settings they contain, not by template family.
  • Skip policies with no BitLocker settings — drops Personal Data Encryption automatically.
  • Add the missing Test-MtConnection Graph check, which this helper lacked.
  • Report shows whether each policy was configured via Endpoint Security or the Settings catalog.

Trade-off: one /settings call per Windows policy. Graph has no server-side filter on setting definition IDs, so this is unavoidable for correctness; platforms has 'windows10' narrows the set and the Invoke-MtGraphRequest session cache absorbs repeats.

Testing

New powershell/tests/functions/Test-MtBitLockerFullDiskEncryption.Tests.ps1, 6/6 passing:

  • BitLocker full encryption in a Settings catalog policy → $true (the regression)
  • Personal Data Encryption profile excluded from the report
  • Used Space Only → $false, with the policy still named in the output rather than claiming none exists
  • No BitLocker settings anywhere → $false
  • Graph not connected → skipped
  • Intune not licensed → skipped

PSScriptAnalyzer clean.

Docs

Companion .md updated: notes that both authoring surfaces count, and the rationale section was tightened. Generated pages (MT.1123.md, the command .mdx) left untouched — update-test-docs.yaml and update-module-docs.yaml refresh those on push to main.

One thing worth deciding before you open it: the test still gates only on the OS drive. That CIS policy has FixedEncryptType: Not configured, which stays unflagged even now that the policy is visible. That's existing design, not a regression, so I left it out of scope — but it may be worth raising in the PR thread or as a separate issue.

Summary by CodeRabbit

  • New Features

    • BitLocker full-disk encryption checks now cover configurations from both Endpoint security and Settings catalog policies.
    • Reports identify the configuration source and flag operating system drives configured for Used Space Only encryption.
  • Bug Fixes

    • Improved handling when no applicable BitLocker settings are found.
    • Added clearer outcomes for unavailable Graph connectivity or Intune licensing.
  • Documentation

    • Clarified full encryption requirements, risks of Used Space Only encryption, and supported configuration locations.

Test-MtBitLockerFullDiskEncryption filtered configurationPolicies on
templateReference/templateFamily eq 'endpointSecurityDiskEncryption', which only
matches policies authored through Endpoint security > Disk encryption. Every
device_vendor_msft_bitlocker_* definition is published with
visibility 'settingsCatalog,template', so BitLocker configured through
Devices > Configuration > Settings catalog is invisible to the test and it
reports "No Endpoint Security Disk Encryption policies found" -- telling the
admin to create a policy that already exists.

Query Windows configuration policies instead and identify BitLocker policies by
their settings. Non-BitLocker policies are skipped, so Personal Data Encryption
profiles sharing the endpointSecurityDiskEncryption family no longer count
towards the policy total.

Also adds the missing Test-MtConnection Graph check and reports whether each
policy was authored via Endpoint Security or the Settings catalog.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 22, 2026 17:42
@royklo
royklo requested a review from a team as a code owner August 22, 2026 17:42
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4adcd056-2e5e-4840-b6bd-ca8fdefe58f2

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf1d98 and 1e4089a.

📒 Files selected for processing (3)
  • powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.md
  • powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.ps1
  • powershell/tests/functions/Test-MtBitLockerFullDiskEncryption.Tests.ps1

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The BitLocker test now evaluates all Windows Intune configuration policies, including Endpoint Security and Settings catalog policies. It detects BitLocker settings, reports configuration sources, handles Graph and licensing skips, and adds comprehensive Pester coverage.

Changes

BitLocker policy coverage

Layer / File(s) Summary
Policy discovery and evaluation
powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.ps1, powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.md
The test retrieves all Windows configuration policies, identifies BitLocker settings, records the configuration source, and documents full encryption requirements.
Policy coverage validation
powershell/tests/functions/Test-MtBitLockerFullDiskEncryption.Tests.ps1
Tests cover Settings catalog detection, Personal Data Encryption exclusion, Used Space Only failures, missing BitLocker settings, Graph skips, and Intune licensing skips.

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

Merge Risk: ⚪ Minimal · up to 1e408

The PR expands BitLocker detection to Settings catalog policies and adds regression coverage; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant IntuneTest
  participant MicrosoftGraph
  participant TestReport
  IntuneTest->>MicrosoftGraph: Check connection
  IntuneTest->>MicrosoftGraph: Retrieve Windows configuration policies
  MicrosoftGraph-->>IntuneTest: Return policy settings
  IntuneTest->>TestReport: Record encryption mode and configuration source
Loading

Suggested reviewers: cloud-architekt

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately identifies Settings catalog detection, but it omits the broader Endpoint security coverage and settings-based policy detection.
Description check ✅ Passed The description clearly explains the problem, fix, testing, documentation updates, trade-off, and out-of-scope behavior, but it omits the template checklist.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

@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.

Pull request overview

Updates the MT.1123 BitLocker full-disk-encryption check to correctly detect BitLocker settings configured via Devices > Configuration > Settings catalog, not just profiles authored under Endpoint security > Disk encryption, eliminating false “no policy found” results and improving reporting.

Changes:

  • Expands policy discovery to Windows configuration policies and identifies BitLocker policies by the BitLocker setting definition IDs they contain.
  • Enhances output to show whether each detected BitLocker policy was configured via Endpoint Security or Settings catalog.
  • Adds unit tests covering settings-catalog detection, exclusion of non-BitLocker policies sharing the template family, and skip conditions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.ps1 Detect BitLocker settings across Windows policies; refine results table and skip gating.
powershell/tests/functions/Test-MtBitLockerFullDiskEncryption.Tests.ps1 New unit tests validating settings-catalog detection and edge cases.
powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.md Updates companion documentation to reflect support for both authoring surfaces.
Suppressed comments (1)

powershell/public/maester/intune/Test-MtBitLockerFullDiskEncryption.ps1:27

  • The comment-based help under .EXAMPLE still refers to a "Disk Encryption policy" and uses inconsistent capitalization ("Used space only"). Since this function now evaluates BitLocker settings across all Windows configuration policies, the help text should be updated to match the current behavior and wording.
    The test passes only if at least one BitLocker policy has the OS drive encryption type set to
    "Full encryption". It fails if no BitLocker settings exist in any policy, if encryption type is
    set to "Used space only", or if the encryption type setting is not configured.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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