Skip to content

Commit de76305

Browse files
authored
Merge pull request #266 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents c376b1e + 19ca56d commit de76305

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using namespace System.Net
2+
3+
Function Invoke-ExecCombinedSetup {
4+
<#
5+
.FUNCTIONALITY
6+
Entrypoint,AnyTenant
7+
.ROLE
8+
CIPP.AppSettings.ReadWrite.
9+
#>
10+
[CmdletBinding()]
11+
param($Request, $TriggerMetadata)
12+
#Make arraylist of Results
13+
$Results = [System.Collections.ArrayList]::new()
14+
try {
15+
if ($request.body.selectedBaselines -and $request.body.baselineOption -eq 'downloadBaselines') {
16+
#do a single download of the selected baselines.
17+
foreach ($template in $request.body.selectedBaselines) {
18+
$object = @{
19+
TenantFilter = 'No tenant'
20+
Name = "Download Single Baseline: $($template.value)"
21+
Command = @{
22+
value = 'New-CIPPTemplateRun'
23+
}
24+
Parameters = @{
25+
TemplateSettings = @{
26+
ca = $false
27+
intuneconfig = $false
28+
intunecompliance = $false
29+
intuneprotection = $false
30+
templateRepo = @{
31+
label = $Template.label
32+
value = $template.value
33+
addedFields = @{
34+
branch = 'main'
35+
}
36+
}
37+
templateRepoBranch = @{
38+
label = 'main'
39+
value = 'main'
40+
}
41+
standardsconfig = $true
42+
groupTemplates = $true
43+
policyTemplates = $true
44+
caTemplates = $true
45+
}
46+
}
47+
ScheduledTime = 0
48+
}
49+
$null = Add-CIPPScheduledTask -task $object -hidden $false -DisallowDuplicateName $true -Headers $Request.Headers
50+
$Results.add("Scheduled download of baseline: $($template.value)")
51+
}
52+
}
53+
if ($Request.body.email -or $Request.body.webhook) {
54+
#create hashtable from pscustomobject
55+
$notificationConfig = $request.body | Select-Object email, webhook, onepertenant, logsToInclude, sendtoIntegration, sev | ConvertTo-Json | ConvertFrom-Json -AsHashtable
56+
$notificationResults = Set-CIPPNotificationConfig @notificationConfig
57+
$Results.add($notificationResults)
58+
}
59+
$Results.add('Setup is now complete. You may navigate away from this page and start using CIPP.')
60+
#one more force of reauth so env vars update.
61+
$auth = Get-CIPPAuthentication
62+
} catch {
63+
$Results = [pscustomobject]@{'Results' = "Failed. $($_.InvocationInfo.ScriptLineNumber): $($_.Exception.message)"; severity = 'failed' }
64+
}
65+
66+
# Associate values to output bindings by calling 'Push-OutputBinding'.
67+
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
68+
StatusCode = [HttpStatusCode]::OK
69+
Body = $Results
70+
})
71+
72+
}

Modules/CIPPCore/Public/GraphHelper/Remove-CIPPCache.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function Remove-CIPPCache {
88
)
99
# Remove all tenants except excluded
1010
$TenantsTable = Get-CippTable -tablename 'Tenants'
11-
$Filter = "PartitionKey eq 'Tenants' and Excluded eq false"
11+
$Filter = "PartitionKey eq 'Tenants' and Excluded eq false and delegatedPrivilegeStatus eq 'granularDelegatedAdminPrivileges'"
1212
$ClearIncludedTenants = Get-CIPPAzDataTableEntity @TenantsTable -Filter $Filter -Property PartitionKey, RowKey
1313
if ($ClearIncludedTenants) {
1414
Remove-AzDataTableEntity -Force @TenantsTable -Entity $ClearIncludedTenants

0 commit comments

Comments
 (0)