From dc3c1b1b00d69883d8d518a678f976cbdfc22cc9 Mon Sep 17 00:00:00 2001 From: Merill Fernando Date: Tue, 10 Dec 2024 19:13:05 +1100 Subject: [PATCH] Added deep link to recommendation and guide on marking as dismissed. --- .../Entra/Test-EntraRecommendations.Tests.ps1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/Maester/Entra/Test-EntraRecommendations.Tests.ps1 b/tests/Maester/Entra/Test-EntraRecommendations.Tests.ps1 index 6e61c3a6..31175537 100644 --- a/tests/Maester/Entra/Test-EntraRecommendations.Tests.ps1 +++ b/tests/Maester/Entra/Test-EntraRecommendations.Tests.ps1 @@ -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 { @@ -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 } @@ -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