Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ function Get-CIPPAlertInactiveUsers {
} catch {}
} catch {
$ErrorMessage = Get-CippException -Exception $_
Write-LogMessage -API 'Alerts' -tenant $TenantFilter -message "Failed to check inactive users with licenses for $($TenantFilter): $($ErrorMessage.NormalizedError)" -sev Error -LogData $ErrorMessage
Write-LogMessage -API 'Alerts' -tenant $TenantFilter -message "Failed to check inactive users for $($TenantFilter): $($ErrorMessage.NormalizedError)" -sev Error -LogData $ErrorMessage
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function Get-CIPPAlertRoleEscalableGroups {
}

if ($findings.Count -eq 0) {
Write-LogMessage -API 'Alerts' -tenant $TenantFilter -message "Role-escalable groups alert: no role-escalation group paths found" -sev 'Information'
Write-LogMessage -API 'Alerts' -tenant $TenantFilter -message "Role-escalable groups alert: no role-escalation group paths found" -sev 'Info'
}
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data @($findings)
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function Invoke-CIPPBaselineGroupTemplate {
# Dynamic Distribution Groups are no longer supported by CIPP: EXO canonicalises the recipient
# filter (permanent drift) and Set-DynamicDistributionGroup -RecipientFilter throws. Skip the write
# and surface the skip in the run log instead of failing every remediation.
Write-LogMessage -API 'Baselines' -tenant $TenantFilter -message "Group Template '$($Template.displayName)': skipped - Dynamic Distribution Groups are not supported by CIPP." -Sev 'Warn'
Write-LogMessage -API 'Baselines' -tenant $TenantFilter -message "Group Template '$($Template.displayName)': skipped - Dynamic Distribution Groups are not supported by CIPP." -Sev 'Warning'
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Invoke-CIPPCustomDomainCertificate {

if ($AppService.Site.properties.hostNames -notcontains $Hostname) {
$Message = "No hostname binding exists for '$Hostname' - the domain was removed or never added. Nothing to do."
Write-LogMessage -API 'CustomDomains' -message $Message -sev Warn
Write-LogMessage -API 'CustomDomains' -message $Message -sev Warning
return $Message
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function New-CIPPMFAConnectorToken {
Write-LogMessage -headers $Headers -API 'MFAConnector' -tenant $TenantFilter -message "App management policy for the Azure Multi-Factor Auth Client: $($PolicyUpdate.PolicyAction)" -sev Info
}
} catch {
Write-LogMessage -headers $Headers -API 'MFAConnector' -tenant $TenantFilter -message "Failed to update app management policy for the Azure Multi-Factor Auth Client: $($_.Exception.Message)" -sev Warn
Write-LogMessage -headers $Headers -API 'MFAConnector' -tenant $TenantFilter -message "Failed to update app management policy for the Azure Multi-Factor Auth Client: $($_.Exception.Message)" -sev Warning
}

$SecretStart = (Get-Date).AddMinutes(-5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function Invoke-CIPPOffboardingJob {
$null = New-CIPPAsyncDeployment -JobId $DeploymentId -Names @($Username) -StepTitles (@($Batch | ForEach-Object { $_.Title }) + $NotifySteps) -Source 'Offboarding' -TaskId $TaskInfo.RowKey -TenantFilter $TenantFilter
} catch {
# Progress is a nice-to-have: a storage hiccup here must not fail the offboarding itself.
Write-LogMessage -API $APIName -tenant $TenantFilter -message "Could not write the progress row for $Username : $($_.Exception.Message)" -sev Warn
Write-LogMessage -API $APIName -tenant $TenantFilter -message "Could not write the progress row for $Username : $($_.Exception.Message)" -sev Warning
}
}
for ($i = 0; $i -lt $Batch.Count; $i++) {
Expand Down
2 changes: 1 addition & 1 deletion backend/Modules/CIPPCore/Public/Set-CIPPUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function Set-CIPPUser {
else { 'Security' }
}
} catch {
Write-LogMessage -headers $Headers -API $APIName -tenant $UserObj.tenantFilter -Sev 'Warn' -message "Could not look up group types, falling back to the types supplied by the request: $($_.Exception.Message)"
Write-LogMessage -headers $Headers -API $APIName -tenant $UserObj.tenantFilter -Sev 'Warning' -message "Could not look up group types, falling back to the types supplied by the request: $($_.Exception.Message)"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ function Invoke-ListLogs {
# When true, the Severity/User/Tenant/API/StartDate/EndDate query filters are applied; otherwise the current day is returned unfiltered.
if ($Request.Query.Filter -eq $true) {
$LogLevel = if ($Request.Query.Severity) { ($Request.Query.Severity).split(',') } else { 'Info', 'Warn', 'Warning', 'Error', 'Critical', 'Alert' }
# The UI's Warning option sends 'Warn'; rows are logged as either spelling
if ($LogLevel -contains 'Warn') { $LogLevel = @($LogLevel) + 'Warning' | Select-Object -Unique }
$Username = $Request.Query.User ?? '*'
$TenantFilter = $Request.Query.Tenant
$ApiFilter = $Request.Query.API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Function Invoke-ExecExtensionSync {
} catch {
$StatusCode = [HttpStatusCode]::InternalServerError
$Results = [pscustomobject]@{'Results' = "Could not start NinjaOne Sync: $($_.Exception.Message)" }
Write-LogMessage -API 'Scheduler_Billing' -tenant 'none' -message "Could not start NinjaOne Sync $($_.Exception.Message)" -sev Error
Write-LogMessage -API 'NinjaOneSync' -tenant 'none' -message "Could not start NinjaOne Sync $($_.Exception.Message)" -sev Error
}
}
'Hudu' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Invoke-ExecAddTenant {

$Results = @{'message' = "$($ExistingTenant.displayName) is already onboarded as a GDAP tenant and cannot be converted to a Direct Tenant. To manage it as a Direct Tenant, remove the tenant first under Settings > Tenants, then add it again using the Direct Tenant flow."; 'severity' = 'error' }
$StatusCode = [HttpStatusCode]::BadRequest
Write-LogMessage -tenant $ExistingTenant.defaultDomainName -tenantid $ExistingTenant.customerId -API 'NewTenant' -message "Blocked conversion of GDAP tenant $($ExistingTenant.displayName) to a Direct Tenant, attempted by $ServiceAccount." -Sev 'Warn'
Write-LogMessage -tenant $ExistingTenant.defaultDomainName -tenantid $ExistingTenant.customerId -API 'NewTenant' -message "Blocked conversion of GDAP tenant $($ExistingTenant.displayName) to a Direct Tenant, attempted by $ServiceAccount." -Sev 'Warning'
} elseif ($ExistingTenant) {
# Existing direct tenant - refresh the stored credentials and service account details.
$ExistingTenant | Add-Member -NotePropertyName 'directTenantUserPrincipalName' -NotePropertyValue $ServiceAccount -Force
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function Invoke-ExecOffboardUser {
try {
$DeploymentId = New-CIPPAsyncDeployment -Names $AllUsers -Source 'Offboarding' -TenantFilter $TenantFilter
} catch {
Write-LogMessage -headers $Request.Headers -API $Request.Params.CIPPEndpoint -tenant $TenantFilter -message "Could not create the offboarding progress rows: $($_.Exception.Message)" -sev Warn
Write-LogMessage -headers $Request.Headers -API $Request.Params.CIPPEndpoint -tenant $TenantFilter -message "Could not create the offboarding progress rows: $($_.Exception.Message)" -sev Warning
}

$Failed = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Invoke-CIPPStandardAutoAddProxy {
$QueueItem
)

$TestResult = Test-CIPPStandardLicense -StandardName 'AutoArchive' -TenantFilter $Tenant -Preset Exchange
$TestResult = Test-CIPPStandardLicense -StandardName 'AutoAddProxy' -TenantFilter $Tenant -Preset Exchange
if ($TestResult -eq $false) {
return $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function Invoke-CIPPStandardDisableAdditionalStorageProviders {
}
catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the DisableAddShortcutsToOneDrive state for $Tenant. Error: $ErrorMessage" -Sev Error
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the DisableAdditionalStorageProviders state for $Tenant. Error: $ErrorMessage" -Sev Error
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Invoke-CIPPStandardDisableEntraPortal {
}

if ($Settings.alert -eq $true) {
if ($CurrentInfo.isSoftwareOathEnabled) {
if ($CurrentInfo.restrictNonAdminAccess) {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Disable user access to Entra Portal is enabled' -sev Info
} else {
Write-StandardsAlert -message 'Disable user access to Entra Portal is not enabled' -object $CurrentInfo -tenant $tenant -standardName 'DisableEntraPortal' -standardId $Settings.standardId
Expand All @@ -38,7 +38,7 @@ function Invoke-CIPPStandardDisableEntraPortal {
}

if ($Settings.report -eq $true) {
set-CIPPStandardsCompareField -FieldName 'standards.DisableEntraPortal' -FieldValue $CurrentInfo.isSoftwareOathEnabled -TenantFilter $Tenant
set-CIPPStandardsCompareField -FieldName 'standards.DisableEntraPortal' -FieldValue $CurrentInfo.restrictNonAdminAccess -TenantFilter $Tenant
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Invoke-CIPPStandardExchangeConnectorTemplate {
https://docs.cipp.app/user-documentation/tenant/standards/alignment/templates/available-standards
#>
param($Tenant, $Settings)
$TestResult = Test-CIPPStandardLicense -StandardName 'ExConnector' -TenantFilter $Tenant -Preset Exchange #No Foundation because that does not allow powershell access
$TestResult = Test-CIPPStandardLicense -StandardName 'ExchangeConnectorTemplate' -TenantFilter $Tenant -Preset Exchange #No Foundation because that does not allow powershell access

if ($TestResult -eq $false) {
return $true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function Invoke-CIPPStandardFocusedInbox {

# Input validation
if ([string]::IsNullOrWhiteSpace($state) -or $state -eq 'Select a value') {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'ExternalMFATrusted: Invalid state parameter set' -sev Error
Write-LogMessage -API 'Standards' -tenant $tenant -message 'FocusedInbox: Invalid state parameter set' -sev Error
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function Invoke-CIPPStandardGlobalQuarantineSettings {
https://docs.cipp.app/user-documentation/tenant/standards/alignment/templates/available-standards
#>
param($Tenant, $Settings)
$TestResult = Test-CIPPStandardLicense -StandardName 'QuarantineTemplate' -TenantFilter $Tenant -Preset Exchange #No Foundation because that does not allow powershell access
$TestResult = Test-CIPPStandardLicense -StandardName 'GlobalQuarantineSettings' -TenantFilter $Tenant -Preset Exchange #No Foundation because that does not allow powershell access

if ($TestResult -eq $false) {
return $true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function Invoke-CIPPStandardGroupTemplate {
$GroupTemplates = @($GroupTemplates | Where-Object { "$($_.groupType)" -ne 'dynamicDistribution' })
if ($SkippedDynamicGroups.Count -gt 0) {
$SkippedNames = @($SkippedDynamicGroups.displayName) -join ', '
Write-LogMessage -API 'Standards' -tenant $tenant -message "Group Template: skipped $($SkippedDynamicGroups.Count) Dynamic Distribution Group template(s) ($SkippedNames) - Dynamic Distribution Groups are not supported by CIPP." -sev 'Warn'
Write-LogMessage -API 'Standards' -tenant $tenant -message "Group Template: skipped $($SkippedDynamicGroups.Count) Dynamic Distribution Group template(s) ($SkippedNames) - Dynamic Distribution Groups are not supported by CIPP." -sev 'Warning'
}

if ('dynamicDistribution' -in $GroupTemplates.groupType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Invoke-CIPPStandardIntuneComplianceSettings {
Select-Object secureByDefault, deviceComplianceCheckinThresholdDays
} catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the intuneDeviceReg state for $Tenant. Error: $ErrorMessage" -Sev Error
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the IntuneComplianceSettings state for $Tenant. Error: $ErrorMessage" -Sev Error
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function Invoke-CIPPStandardRestrictThirdPartyStorageServices {
#>

param ($Tenant, $Settings)
$TestResult = Test-CIPPStandardLicense -StandardName 'ThirdPartyStorageServicesRestricted' -TenantFilter $Tenant -Preset SharePoint
$TestResult = Test-CIPPStandardLicense -StandardName 'RestrictThirdPartyStorageServices' -TenantFilter $Tenant -Preset SharePoint

if ($TestResult -eq $false) {
return $true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Invoke-CIPPStandardSharePointMassDeletionAlert {
#>

param ($Tenant, $Settings)
$TestResult = Test-CIPPStandardLicense -StandardName 'DeletedUserRentention' -TenantFilter $Tenant -RequiredCapabilities @('RMS_S_PREMIUM2')
$TestResult = Test-CIPPStandardLicense -StandardName 'SharePointMassDeletionAlert' -TenantFilter $Tenant -RequiredCapabilities @('RMS_S_PREMIUM2')

if ($TestResult -eq $false) {
return $true
Expand All @@ -48,7 +48,7 @@ function Invoke-CIPPStandardSharePointMassDeletionAlert {
Where-Object { $_.Name -eq $PolicyName }
} catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the sharingCapability state for $Tenant. Error: $ErrorMessage" -Sev Error
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the SharePointMassDeletionAlert state for $Tenant. Error: $ErrorMessage" -Sev Error
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Invoke-CIPPStandardallowOAuthTokens {
$CurrentState = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy/authenticationMethodConfigurations/softwareOath' -tenantid $Tenant
} catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the allowOTPTokens state for $Tenant. Error: $ErrorMessage" -Sev Error
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Could not get the allowOAuthTokens state for $Tenant. Error: $ErrorMessage" -Sev Error
return
}
$StateIsCorrect = ($CurrentState.state -eq 'enabled')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Invoke-CIPPStandardintuneRestrictUserDeviceJoin {
if ($StateIsCorrect -eq $true) {
Write-LogMessage -API 'Standards' -tenant $Tenant -message "Device join restriction is already configured (users allowed to join: $DesiredStateText)." -sev Info
} elseif ($IsAdminConfigurable -eq $false) {
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Cannot remediate device join restriction: azureADJoin.isAdminConfigurable is false for this tenant. Skipping remediation.' -sev Warn
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Cannot remediate device join restriction: azureADJoin.isAdminConfigurable is false for this tenant. Skipping remediation.' -sev Warning
} else {
try {
$PreviousSetting.azureADJoin.allowedToJoin = @{ '@odata.type' = $DesiredOdataType; users = $null; groups = $null }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Invoke-CIPPStandardintuneRestrictUserDeviceRegistration {
if ($StateIsCorrect -eq $true) {
Write-LogMessage -API 'Standards' -tenant $Tenant -message "Device registration restriction is already configured (users allowed to register: $DesiredStateText)." -sev Info
} elseif ($IsAdminConfigurable -eq $false) {
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Cannot remediate device registration restriction: azureADRegistration.isAdminConfigurable is false for this tenant (commonly because Intune is enabled). Skipping remediation.' -sev Warn
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Cannot remediate device registration restriction: azureADRegistration.isAdminConfigurable is false for this tenant (commonly because Intune is enabled). Skipping remediation.' -sev Warning
} else {
try {
$PreviousSetting.azureADRegistration.allowedToRegister = @{ '@odata.type' = $DesiredOdataType; users = $null; groups = $null }
Expand Down
Loading