File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Modules/CIPPCore/Public/Alerts Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change 1+ function Get-CIPPAlertSecDefaultsDisabled {
2+ <#
3+ . FUNCTIONALITY
4+ Entrypoint
5+ #>
6+ [CmdletBinding ()]
7+ param (
8+ [Parameter (Mandatory = $false )]
9+ [Alias (' input' )]
10+ $InputValue ,
11+ $TenantFilter
12+ )
13+
14+ try {
15+ # Check if Security Defaults is disabled
16+ $SecDefaults = (New-GraphGetRequest - uri ' https://graph.microsoft.com/beta/policies/identitySecurityDefaultsEnforcementPolicy' - tenantid $TenantFilter )
17+
18+ if ($SecDefaults.isEnabled -eq $false ) {
19+ # Security Defaults is disabled, now check if there are any CA policies
20+ $CAPolicies = (New-GraphGetRequest - uri ' https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies' - tenantid $TenantFilter )
21+
22+ if (! $CAPolicies -or $CAPolicies.Count -eq 0 ) {
23+ # Security Defaults is off AND no CA policies exist
24+ $AlertData = [PSCustomObject ]@ {
25+ Message = ' Security Defaults is disabled and no Conditional Access policies are configured. This tenant has no baseline security protection.'
26+ Tenant = $TenantFilter
27+ }
28+
29+ Write-AlertTrace - cmdletName $MyInvocation.MyCommand - tenantFilter $TenantFilter - data $AlertData
30+ }
31+ }
32+ } catch {
33+ Write-AlertMessage - tenant $ ($TenantFilter ) - message " Security Defaults Disabled Alert: Error occurred: $ ( Get-NormalizedError - message $_.Exception.message ) "
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments