Skip to content

Commit

Permalink
Added check for CA policy to be enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
merill committed Dec 5, 2023
1 parent 07111f6 commit 51e809e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/public/Test-MtCaHasDeviceCompliance.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Function Test-MtCaHasDeviceCompliance {

$policies = Get-MtConditionalAccessPolicies

$result = & { Set-StrictMode -Off; $policies.value.grantcontrols.builtincontrols -contains 'compliantDevice' }
$result = & { Set-StrictMode -Off; $policies.value.grantcontrols.builtincontrols -contains 'compliantDevice' -and $pol.value.state -eq 'enabled' }
return $result

}
4 changes: 2 additions & 2 deletions tests/Identity/Test-ConditionalAccessBaseline.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ BeforeDiscovery {
}

BeforeAll {

$policies = Get-MtConditionalAccessPolicies
}

Describe "Conditional Access Baseline Policies" -Tag "CA", "Security", "All" {
It "ID1001: At least one Conditional Access policy is configured with device compliance" {
Test-MtCaHasDeviceCompliance | Should -Be $true
Test-MtCaHasDeviceCompliance $policies | Should -Be $true
}
}

0 comments on commit 51e809e

Please sign in to comment.