Skip to content

Commit 91fe32f

Browse files
authored
Merge pull request #388 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 15c998f + 3c432bb commit 91fe32f

File tree

8 files changed

+37
-31
lines changed

8 files changed

+37
-31
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecStandardsRun.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-ExecStandardsRun {
3+
function Invoke-ExecStandardsRun {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -38,7 +38,7 @@ Function Invoke-ExecStandardsRun {
3838

3939
$ProcessorFunction = [PSCustomObject]@{
4040
PartitionKey = 'Function'
41-
RowKey = "Invoke-CIPPStandardsRun-$TenantFilter"
41+
RowKey = "Invoke-CIPPStandardsRun-$TenantFilter-$TemplateId"
4242
FunctionName = 'Invoke-CIPPStandardsRun'
4343
Parameters = [string](ConvertTo-Json -Compress -InputObject @{
4444
TenantFilter = $TenantFilter

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ExecUpdateDriftDeviation.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ function Invoke-ExecUpdateDriftDeviation {
3838
result = $Result
3939
}
4040
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Updated drift deviation status for $($Deviation.standardName) to $($Deviation.status)" -Sev 'Info'
41+
if ($Deviation.status -eq 'DeniedRemediate') {
42+
$Setting = $Deviation.standardName -replace 'standards.', ''
43+
$StandardTemplate = Get-CIPPTenantAlignment -TenantFilter $TenantFilter | Where-Object -Property standardType -EQ 'drift'
44+
$StandardTemplate = $StandardTemplate.$Setting
45+
$StandardTemplate.action = @(
46+
@{label = 'Report'; value = 'Report' },
47+
@{ label = 'Remediate'; value = 'Remediate' }
48+
)
49+
#idea here is to make a system job that triggers the remediation process, so that users can click on "Deniedremediate"
50+
#That job then launches a single standard run, it gets the same input as an orch, but is just a scheduled job.
51+
52+
}
53+
if ($Deviation.status -eq 'deniedDelete') {
54+
#Here we look at the policy ID received and the type, and nuke it.
55+
}
4156
} catch {
4257
[PSCustomObject]@{
4358
standardName = $Deviation.standardName

Modules/CIPPCore/Public/Functions/Get-CIPPTenantAlignment.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function Get-CIPPTenantAlignment {
5252

5353
# Get standards comparison data
5454
$StandardsTable = Get-CIPPTable -TableName 'CippStandardsReports'
55-
$AllStandards = Get-CIPPAzDataTableEntity @StandardsTable
55+
$AllStandards = Get-CIPPAzDataTableEntity @StandardsTable -Filter "PartitionKey ne 'StandardReport'"
5656

5757
# Filter by tenant if specified
5858
$Standards = if ($TenantFilter) {
@@ -263,6 +263,7 @@ function Get-CIPPTenantAlignment {
263263
return $Results
264264
} catch {
265265
Write-Error "Error getting tenant alignment data: $($_.Exception.Message)"
266+
Write-Information $_.InvocationInfo.PositionMessage
266267
throw
267268
}
268269
}

Modules/CIPPCore/Public/Get-CIPPDrift.ps1

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,10 @@ function Get-CIPPDrift {
188188
$TenantCAPolicies = @()
189189
}
190190

191-
# Always update cache with fresh data
192-
try {
193-
$CacheTable = Get-CippTable -tablename 'cacheDrift'
194-
$IntuneJsonString = "`"$($TenantIntunePolicies | ConvertTo-Json -Depth 10 -Compress | ForEach-Object { $_ -replace '"', '\"' })`""
195-
$CAJsonString = "`"$($TenantCAPolicies | ConvertTo-Json -Depth 10 -Compress | ForEach-Object { $_ -replace '"', '\"' })`""
196-
197-
$CacheEntity = @{
198-
PartitionKey = 'drift'
199-
RowKey = $TenantFilter
200-
IntuneJson = $IntuneJsonString
201-
CAJson = $CAJsonString
202-
}
203-
Add-CIPPAzDataTableEntity @CacheTable -Entity $CacheEntity -Force
204-
} catch {
205-
Write-Warning "Failed to cache policy data: $($_.Exception.Message)"
206-
}
207191
}
208192

209193
if ($Alignment.standardSettings) {
210-
if ($Alignment.standardSettings.IntuneTemplates) {
194+
if ($Alignment.standardSettings.IntuneTemplate) {
211195
$IntuneTemplateIds = $Alignment.standardSettings.IntuneTemplate.TemplateList | ForEach-Object { $_.value }
212196
}
213197
if ($Alignment.standardSettings.ConditionalAccessTemplate) {

Modules/CIPPCore/Public/Set-CIPPDriftDeviation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function Set-CIPPDriftDeviation {
2727
[string]$StandardName,
2828

2929
[Parameter(Mandatory = $true)]
30-
[ValidateSet('Accepted', 'New', 'Denied', 'CustomerSpecific')]
30+
[ValidateSet('Accepted', 'New', 'Denied', 'CustomerSpecific', 'DeniedRemediate', 'DeniedDelete')]
3131
[string]$Status
3232
)
3333

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardConditionalAccessTemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function Invoke-CIPPStandardConditionalAccessTemplate {
3131
param($Tenant, $Settings)
3232
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'ConditionalAccess'
3333
$Table = Get-CippTable -tablename 'templates'
34-
$TestResult = Test-CIPPStandardLicense -StandardName 'ConditionalAccessTemplate' -TenantFilter $Tenant -RequiredCapabilities @('AAD_PREMIUM', 'AAD_PREMIUM_P2')
34+
$TestResult = Test-CIPPStandardLicense -StandardName 'ConditionalAccessTemplates_general' -TenantFilter $Tenant -RequiredCapabilities @('AAD_PREMIUM', 'AAD_PREMIUM_P2')
3535
if ($TestResult -eq $false) {
3636
#writing to each item that the license is not present.
3737
$settings.TemplateList | ForEach-Object {

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneTemplate.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function Invoke-CIPPStandardIntuneTemplate {
3131
https://docs.cipp.app/user-documentation/tenant/standards/list-standards
3232
#>
3333
param($Tenant, $Settings)
34-
$TestResult = Test-CIPPStandardLicense -StandardName 'IntuneTemplate' -TenantFilter $Tenant -RequiredCapabilities @('INTUNE_A', 'MDM_Services', 'EMS', 'SCCM', 'MICROSOFTINTUNEPLAN1')
34+
$TestResult = Test-CIPPStandardLicense -StandardName 'IntuneTemplate_general' -TenantFilter $Tenant -RequiredCapabilities @('INTUNE_A', 'MDM_Services', 'EMS', 'SCCM', 'MICROSOFTINTUNEPLAN1')
3535
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'intuneTemplate'
3636

3737
if ($TestResult -eq $false) {

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpoofWarn.ps1

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,22 @@ function Invoke-CIPPStandardSpoofWarn {
4848

4949
# Test if all entries in the AllowListAdd variable are in the AllowList
5050
$AllowListCorrect = $true
51-
$AllowListAddEntries = foreach ($entry in $AllowListAdd) {
52-
if ($CurrentInfo.AllowList -notcontains $entry) {
53-
$AllowListCorrect = $false
54-
Write-Host "AllowList entry $entry not found in current AllowList"
55-
$entry
56-
} else {
57-
Write-Host "AllowList entry $entry found in current AllowList."
51+
52+
if ($AllowListAdd -eq $null -or $AllowListAdd.Count -eq 0) {
53+
Write-Host 'No AllowList entries provided, skipping AllowList check.'
54+
$AllowListAdd = @{'@odata.type' = '#Exchange.GenericHashTable'; Add = @() }
55+
} else {
56+
$AllowListAddEntries = foreach ($entry in $AllowListAdd) {
57+
if ($CurrentInfo.AllowList -notcontains $entry) {
58+
$AllowListCorrect = $false
59+
Write-Host "AllowList entry $entry not found in current AllowList"
60+
$entry
61+
} else {
62+
Write-Host "AllowList entry $entry found in current AllowList."
63+
}
5864
}
65+
$AllowListAdd = @{'@odata.type' = '#Exchange.GenericHashTable'; Add = $AllowListAddEntries }
5966
}
60-
$AllowListAdd = @{'@odata.type' = '#Exchange.GenericHashTable'; Add = $AllowListAddEntries }
6167

6268
# Debug output
6369
# Write-Host ($CurrentInfo | ConvertTo-Json -Depth 10)

0 commit comments

Comments
 (0)