Skip to content

BugFIX - 25550 - flag as failed for a tenant that has no Azure Firewall#968

Draft
Manoj-Kesana wants to merge 1 commit intomainfrom
Bug-25550
Draft

BugFIX - 25550 - flag as failed for a tenant that has no Azure Firewall#968
Manoj-Kesana wants to merge 1 commit intomainfrom
Bug-25550

Conversation

@Manoj-Kesana
Copy link
Collaborator

@Manoj-Kesana Manoj-Kesana commented Feb 27, 2026

Fix #961

@Manoj-Kesana Manoj-Kesana self-assigned this Feb 27, 2026
@Manoj-Kesana Manoj-Kesana marked this pull request as ready for review March 2, 2026 08:20
@Manoj-Kesana Manoj-Kesana requested a review from merill March 2, 2026 08:21
@Manoj-Kesana Manoj-Kesana changed the title Bug - 25550 - flag as failed for a tenant that has no Azure Firewall BugFIX - 25550 - flag as failed for a tenant that has no Azure Firewall Mar 2, 2026
@Manoj-Kesana Manoj-Kesana added the ready for review PR is ready for review and merging label Mar 3, 2026
@alexandair alexandair requested a review from Copilot March 4, 2026 20:47
Copy link
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

Adjusts Azure Network Security assessment test 25550 to avoid reporting a failure when no Azure Firewall Premium policies exist in the tenant/subscriptions.

Changes:

  • Replaces the “❌ No Azure Firewall Premium policies found…” failure output with a NotApplicable skip path.
  • Adds a verbose diagnostic message and returns early when no Premium policies are discovered.

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

You can also share your feedback on Copilot code review. Take the survey.

@Manoj-Kesana Manoj-Kesana requested a review from alexandair March 5, 2026 03:58
Copy link
Collaborator

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

As we are already changing this test, should we replace Invoke-AzRestMethod with ARG query like we do for other similar tests?

@@ -180,7 +180,9 @@ function Test-Assessment-25550 {
$testResultMarkdown = ''

if ($firewallPoliciesWithTLS.Count -eq 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Critical Issue — Skip is too broad, masks a spec-required Fail case

The $firewallPoliciesWithTLS array is only populated from Premium policies. When .Count -eq 0, there are two distinct scenarios:

Scenario Spec says PR does
No firewall policies at all in any subscription Skipped ✅ Skipped (correct)
Firewall policies exist but none are Premium Fail (spec eval step 5) ❌ Skipped (incorrect)

The spec explicitly states (eval step 5):

"If premiumPolicies is empty → Fail (firewall policies exist but no Premium SKU found)"

Fix: Track whether any firewall policies were found across all subscriptions, then differentiate:

# Before the subscription loop, add:
$anyFirewallPoliciesFound = $false

# Inside the subscription loop, after collecting $fwPolicies:
if ($fwPolicies.Count -gt 0) {
    $anyFirewallPoliciesFound = $true
}

# In assessment logic, replace the single if-block:
if ($firewallPoliciesWithTLS.Count -eq 0 -and -not $anyFirewallPoliciesFound) {
    Write-PSFMessage 'No Azure Firewall policies found in any subscription.' -Tag Test -Level VeryVerbose
    Add-ZtTestResultDetail -SkippedBecause NotApplicable
    return
}
elseif ($firewallPoliciesWithTLS.Count -eq 0) {
    # Policies exist but none are Premium — this is a fail
    $testResultMarkdown = "❌ Azure Firewall policies were found but none use the Premium SKU required for TLS inspection.`n`n"
}

There is also this issue (pre-existing, not introduced by this PR):

⚠️ Missing properties.firewalls check (spec eval step 5–6)

The spec requires checking whether a Premium policy is attached to an actual firewall:

"Check if properties.firewalls exists and is non-empty. If empty or missing → skip this policy."

The code never checks $policyDetail.properties.firewalls. Unattached policies are evaluated as if they're active, which could cause false passes or false fails on orphaned policies.

@Manoj-Kesana Manoj-Kesana marked this pull request as draft March 6, 2026 07:55
@Manoj-Kesana Manoj-Kesana removed the ready for review PR is ready for review and merging label Mar 6, 2026
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.

Netspec 25550 - flag as failed for a tenant that has no Azure Firewall

3 participants