Skip to content

Commit

Permalink
Add example in docs and context tag
Browse files Browse the repository at this point in the history
  • Loading branch information
weyCC81 committed Dec 3, 2024
1 parent cbc359f commit d2296a7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/Maester/Entra/Test-ConditionalAccessBaseline.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
It "MT.1036: All excluded objects should have a fallback include in another policy. See https://maester.dev/docs/tests/MT.1036" -Tag "MT.1036", "Warning" {
Test-MtCaGap | Should -Be $true -Because "there is one ore more object excluded without an include fallback in another policy."
}
Context "License utilization" {
Context "License utilization" -Tag "LicenseUtilization" {
It "MT.1022: All users utilizing a P1 license should be licensed. See https://maester.dev/docs/tests/MT.1022" -Tag "MT.1022" {
$LicenseReport = Test-MtCaLicenseUtilization -License "P1"
$LicenseReport.TotalLicensesUtilized | Should -BeLessOrEqual $LicenseReport.EntitledLicenseCount -Because "this is the maximium number of user that can utilize a P1 license"
Expand All @@ -81,6 +81,15 @@ Describe "Security Defaults" -Tag "CA", "Security", "All" {
Add-MtTestResultDetail -SkippedBecause LicensedEntraIDPremium
} else {
$SecurityDefaults = Invoke-MtGraphRequest -RelativeUri "policies/identitySecurityDefaultsEnforcementPolicy" -ApiVersion beta | Select-Object -ExpandProperty isEnabled

if ($SecurityDefaults -eq $true) {
$testResultMarkdown = "Well done. SecurityDefaults are On `n`n"
} else {
$testResultMarkdown = "SecurityDefaults are Off '$($SecurityDefaults)' `n`n"
}
$testDetailsMarkdown = "You should enable SecurityDefaults or configure Conditional Access."
Add-MtTestResultDetail -Description $testDetailsMarkdown -Result $testResultMarkdown

$SecurityDefaults | Should -Be $true -Because "Security Defaults are not enabled"
}
}
Expand Down
15 changes: 15 additions & 0 deletions website/docs/commands/Invoke-Maester.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ Invoke-Maester -PesterConfiguration $configuration
```

### EXAMPLE 12

```powershell
$exclude_tags1 = @('CA', 'App') # System.Array
$exclude_tags2 = @('MT.1028', 'MT.1024') # System.Array
$exclude_tags_combined = $exclude_tags1 + $exclude_tags2
#Invoke-Maester -ExcludeTag $exclude_tags_combined -Verbose
Invoke-Maester -ExcludeTag $exclude_tags_combined
```

This combines two arrays of exclusion tags and runs the tests, excluding any tests with those tags.


## PARAMETERS

### -Path
Expand Down

0 comments on commit d2296a7

Please sign in to comment.