Add MT.1185: Block legacy MSOnline (MSOL) PowerShell module#1972
Conversation
The blockMsolPowerShell setting on the tenant's authorization policy blocks authentication requests from the retired MSOnline PowerShell module. It isn't enabled by default for every tenant, so this check verifies the current state via Graph rather than assuming it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds ChangesEntra MSOL PowerShell blocking
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant MaesterTest
participant TestMtEntraMsolPowerShellBlocked
participant MicrosoftGraph
MaesterTest->>TestMtEntraMsolPowerShellBlocked: Invoke MT.1185
TestMtEntraMsolPowerShellBlocked->>MicrosoftGraph: Query authorizationPolicy
MicrosoftGraph-->>TestMtEntraMsolPowerShellBlocked: Return blockMsolPowerShell
TestMtEntraMsolPowerShellBlocked-->>MaesterTest: Return check result
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
powershell/public/maester/entra/Test-MtEntraMsolPowerShellBlocked.md (1)
11-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFix markdown heading increment.
As per static analysis hints, heading levels should only increment by one level at a time. The
####headings skip a level following the## Why This Mattersheading.♻️ Proposed fix
-#### Remediation action: +### Remediation action: 1. Connect to Graph using **Connect-MgGraph -Scopes "Policy.ReadWrite.Authorization"**. 2. Run the following PowerShell command to review the current value: ```powershell Get-MgPolicyAuthorizationPolicy | Select-Object BlockMsolPowerShell
- If
BlockMsolPowerShellis$false, block the legacy MSOnline PowerShell module:$authPolicy = Get-MgPolicyAuthorizationPolicy Update-MgPolicyAuthorizationPolicy -AuthorizationPolicyId $authPolicy.Id -BlockMsolPowerShell:$true-#### Related links
+### Related links</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.In
@powershell/public/maester/entra/Test-MtEntraMsolPowerShellBlocked.mdaround
lines 11 - 24, Change the “Related links” heading in
Test-MtEntraMsolPowerShellBlocked.md from level four to level three so it
follows the preceding level-two section without skipping a heading level.</details> <!-- cr-comment:v1:e0b8ace1fdbc5e3358d04202 --> _Source: Linters/SAST tools_ </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.Nitpick comments:
In@powershell/public/maester/entra/Test-MtEntraMsolPowerShellBlocked.md:
- Around line 11-24: Change the “Related links” heading in
Test-MtEntraMsolPowerShellBlocked.md from level four to level three so it
follows the preceding level-two section without skipping a heading level.</details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Path: .coderabbit.yaml **Review profile**: CHILL **Plan**: Pro Plus **Run ID**: `1aae43bd-e646-439a-9cd4-da10e3097c63` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 17c6f8fff74e8e7dc9ca069738259ecfb7d18e6d and b20a30501bb5abe59a540bb5da7bdfe943eaf593. </details> <details> <summary>📒 Files selected for processing (5)</summary> * `powershell/Maester.psd1` * `powershell/public/maester/entra/Test-MtEntraMsolPowerShellBlocked.md` * `powershell/public/maester/entra/Test-MtEntraMsolPowerShellBlocked.ps1` * `tests/Maester/Entra/Test-MtEntraMsolPowerShellBlocked.Tests.ps1` * `tests/maester-config.json` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
|
Good stuff again @BakkerJan FYI Just a minor tweak. I've updated the remediate code block to use the same example as in the official Microsoft docs. |
Summary
Adds
Test-MtEntraMsolPowerShellBlocked(MT.1185, High severity) which checks theblockMsolPowerShellproperty on the tenant'sauthorizationPolicy(Microsoft Graph).The MSOnline (MSOL) and Azure AD PowerShell modules were retired by Microsoft and no longer receive security updates. The
blockMsolPowerShellsetting lets an admin explicitly block authentication requests from the legacy MSOnline PowerShell module's service principal. This setting isn't enabled by default for every tenant, so it's worth an explicit, standing check rather than assuming it's already in place.Reserved via #697 (comment).
Test plan
Invoke-ScriptAnalyzeragainst the new function file — no issues./build/Build-LocalMaester.ps1— builds and loads cleanly./powershell/tests/pester.ps1— full suite, 10056/10056 tests passedReference
Summary by CodeRabbit
New Features
Documentation
Tests
Chores