Skip to content

Commit

Permalink
Added deep link to recommendation and guide on marking as dismissed.
Browse files Browse the repository at this point in the history
  • Loading branch information
merill committed Dec 10, 2024
1 parent d4951bd commit dc3c1b1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/Maester/Entra/Test-EntraRecommendations.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Describe "Entra Recommendations" -Tag "Maester", "Entra", "Security", "All", "Re
"userRiskPolicy",
"signinRiskPolicy"
)
$recommendationUrl = "https://entra.microsoft.com/#view/Microsoft_AAD_IAM/RecommendationDetails.ReactView/recommendationId/$id"
$recommendationLinkMd = "`n`n➡️ Open [Recommendation - $displayName]($recommendationUrl) in the Entra admin portal."

$EntraIDPlan = Get-MtLicenseInformation -Product "EntraID"
if ( $EntraIDPlan -ne "P2" ) {
$EntraPremiumRecommendations | ForEach-Object {
Expand All @@ -26,7 +29,7 @@ Describe "Entra Recommendations" -Tag "Maester", "Entra", "Security", "All", "Re
}

if ( $status -match "dismissed" ) {
Add-MtTestResultDetail -SkippedBecause Custom -SkippedCustomReason "Status:Dismissed for '$($id)'"
Add-MtTestResultDetail -Description $benefits -SkippedBecause Custom -SkippedCustomReason "This recommendation has been **Dismissed** by an administrator.`n`nIf this test is valid for your tenant you can change it's state from **Dismissed** to **Active**. $recommendationLinkMd"
return $null
}

Expand All @@ -47,7 +50,14 @@ Describe "Entra Recommendations" -Tag "Maester", "Entra", "Security", "All", "Re
$impactedResourcesList += "| $($resourceResult) | [$($resource.displayName)]($($resource.portalUrl)) | $($resource.addedDateTime) | `n"
}
}
$ResultMarkdown = $insights + $impactedResourcesList + "`n`n#### Remediation actions:`n`n" + $ActionSteps

if( $status -eq 'completedBySystem' ) {
$deepLink = $recommendationLinkMd
} else {
$deepLink = "`n`nIf the recommendation is not applicable for your tenant, it can be marked as **Dismissed** for Maester to skip it in the future. $recommendationLinkMd"
}

$ResultMarkdown = $insights + $deepLink + $impactedResourcesList + "`n`n#### Remediation actions:`n`n" + $ActionSteps
Add-MtTestResultDetail -Description $benefits -Result $ResultMarkdown
#endregion
# Actual test
Expand Down

0 comments on commit dc3c1b1

Please sign in to comment.