Skip to content

Commit

Permalink
Fix to #215
Browse files Browse the repository at this point in the history
  • Loading branch information
soulemike committed Jul 8, 2024
1 parent 5cb7ac1 commit 1cc9b23
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 8 additions & 3 deletions powershell/public/CISA/Entra/Test-MtCisaWeakFactor.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,28 @@ Function Test-MtCisaWeakFactor {
"Email"
)

$isMethodsMigrationComplete = Test-MtCisaMethodsMigration

$result = Get-MtAuthenticationMethodPolicyConfig

$weakAuthMethods = $result | Where-Object { $_.id -in $weakFactors }

$enabledWeakMethods = $weakAuthMethods | Where-Object { $_.state -eq "enabled" }

$testResult = ($enabledWeakMethods|Measure-Object).Count -eq 0
$testResult = (($enabledWeakMethods|Measure-Object).Count -eq 0) -and $isMethodsMigrationComplete

if ($testResult) {
$testResultMarkdown = "Well done. All weak authentication methods are disabled in your tenant.`n`n%TestResult%"
} else {
$testResultMarkdown = "One or more weak methods are enabled in your tenant.`n`n%TestResult%"
$testResultMarkdown = "One or more weak methods are enabled in your tenant, or migration to Authentication Methods is incomplete.`n`n%TestResult%"
}

# Auth method does not support deep links.
$authMethodsLink = "https://entra.microsoft.com/#view/Microsoft_AAD_IAM/AuthenticationMethodsMenuBlade/~/AdminAuthMethods"
$result = "| Authentication Method | State | Test Result |`n"
$migrationResult = "❌ Fail"
if($isMethodsMigrationComplete){$migrationResult = "✅ Pass"}
$result = "[Authentication Methods]($authMethodsLink) Migration Complete: $migrationResult`n`n"
$result += "| Authentication Method | State | Test Result |`n"
$result += "| --- | --- | --- |`n"
foreach ($item in $weakAuthMethods) {
$methodResult = "✅ Pass"
Expand Down
4 changes: 1 addition & 3 deletions tests/CISA/Entra/Test-MtCisaWeakFactor.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ BeforeDiscovery {
Describe "CISA SCuBA" -Tag "MS.AAD", "MS.AAD.3.5", "CISA", "Security", "All" -Skip:( $EntraIDPlan -eq "Free" ) {
It "MS.AAD.3.5: The authentication methods SMS, Voice Call, and Email One-Time Passcode (OTP) SHALL be disabled." {

$isMethodsMigrationComplete = Test-MtCisaMethodsMigration

$isWeakFactorDisabled = Test-MtCisaWeakFactor

$isWeakFactorDisabled -and $isMethodsMigrationComplete | Should -Be $true -Because "all weak authentication methods are disabled."
$isWeakFactorDisabled | Should -Be $true -Because "all weak authentication methods are disabled."
}
}

0 comments on commit 1cc9b23

Please sign in to comment.