Skip to content

AI - 61002 - Microsoft Sentinel is onboarded on at least one Log Analytics workspace#1241

Open
Manoj-Kesana wants to merge 1 commit into
devfrom
Feature-61002
Open

AI - 61002 - Microsoft Sentinel is onboarded on at least one Log Analytics workspace#1241
Manoj-Kesana wants to merge 1 commit into
devfrom
Feature-61002

Conversation

@Manoj-Kesana
Copy link
Copy Markdown
Collaborator

Microsoft Sentinel is onboarded on at least one Log Analytics workspace

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new AI pillar assessment (61002) to verify Microsoft Sentinel is onboarded on at least one Log Analytics workspace, providing reporting output and remediation guidance.

Changes:

  • Introduces Test-Assessment-61002 PowerShell test to enumerate Log Analytics workspaces via Azure Resource Graph and check Sentinel onboarding state per workspace via ARM.
  • Generates markdown reporting summarizing workspaces and onboarding status with Azure portal links.
  • Adds companion markdown description/remediation content for assessment 61002.

Reviewed changes

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

File Description
src/powershell/tests/Test-Assessment.61002.ps1 Implements the Sentinel onboarding assessment logic and report output.
src/powershell/tests/Test-Assessment.61002.md Provides end-user description and remediation links, with %TestResult% insertion point.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/powershell/tests/Test-Assessment.61002.ps1
Comment thread src/powershell/tests/Test-Assessment.61002.ps1
@Manoj-Kesana Manoj-Kesana requested a review from alexandair May 26, 2026 07:14
@Manoj-Kesana Manoj-Kesana added the ready for review PR is ready for review and merging label May 26, 2026
Copy link
Copy Markdown
Contributor

@alexandair alexandair left a comment

Choose a reason for hiding this comment

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

@Manoj-Kesana Please, address my feedback.


$sentinelOnboarded = $false
try {
$sentinelResponse = Invoke-ZtAzureRequest -Path $sentinelPath -FullResponse -ErrorAction Stop
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.

403 is silently treated as 404 in Q3 loop (false-negative risk)

The Invoke-ZtAzureRequest -FullResponse documentation explicitly states it does not throw on non-2xx status codes. This means both HTTP 403 (access denied) and HTTP 404 (Sentinel not onboarded) fall through to the same code path:

$sentinelOnboarded = ($sentinelResponse.StatusCode -eq 200)  # $false for both 403 AND 404

If the scan identity lacks the Microsoft Sentinel Reader role on one or more workspaces, those workspaces are silently reported as "Sentinel not onboarded" — a false negative with no trace in the output. The spec requires Sentinel Reader for Q3, and this permission is easy to miss.

Recommendation: Check $sentinelResponse.StatusCode explicitly and track 403s separately. If at least one workspace returns 403 and none passes, use CustomStatus = 'Investigate':

$sentinelOnboarded = $false
$accessDenied = $false
if ($sentinelResponse.StatusCode -eq 200) {
    $sentinelOnboarded = $true
}
elseif ($sentinelResponse.StatusCode -eq 403) {
    $accessDenied = $true
    Write-PSFMessage "Access denied checking Sentinel onboarding for '$($workspace.workspaceName)' (403)" -Tag Test -Level Warning
}

Then in Assessment Logic, if $passed -eq $false and any workspace returned 403, set $customStatus = 'Investigate' and surface an explanation in the result.

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

Labels

ready for review PR is ready for review and merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants