Skip to content

Commit a689132

Browse files
authored
Merge pull request #68 from KelvinTegelaar/master
[pull] master from KelvinTegelaar:master
2 parents f68b552 + cbb781a commit a689132

File tree

8 files changed

+39
-13
lines changed

8 files changed

+39
-13
lines changed

Diff for: Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecEditTemplate.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Function Invoke-ExecEditTemplate {
2121

2222
if ($Type -eq 'IntuneTemplate') {
2323
Write-Host 'Intune Template'
24-
$OriginalTemplate = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'IntuneTemplate' and GUID eq '$GUID'"
24+
$OriginalTemplate = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq 'IntuneTemplate' and RowKey eq '$GUID'"
2525
$OriginalTemplate = ($OriginalTemplate.JSON | ConvertFrom-Json -Depth 100)
2626
$RawJSON = $OriginalTemplate.RAWJson
27-
Set-CIPPIntuneTemplate -RawJSON $RawJSON -GUID $GUID -DisplayName $Request.body.displayName -Description $Request.body.description -templateType $Request.body.type
27+
Set-CIPPIntuneTemplate -RawJSON $RawJSON -GUID $GUID -DisplayName $Request.body.displayName -Description $Request.body.description -templateType $OriginalTemplate.Type
2828
} else {
2929
$Table.Force = $true
3030

Diff for: Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ListGraphRequest.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ function Invoke-ListGraphRequest {
122122
$Results = Get-GraphRequestList @GraphRequestParams
123123
if ($Results.nextLink) {
124124
Write-Host "NextLink: $($Results.nextLink | Select-Object -Last 1)"
125-
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
125+
if ($Request.Query.TenantFilter -ne 'AllTenants') {
126+
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
127+
}
126128
#Results is an array of objects, so we need to remove the last object before returning
127129
$Results = $Results | Select-Object -First ($Results.Count - 1)
128130
}

Diff for: Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecWebhookSubscriptions.ps1

+20
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,26 @@ function Invoke-ExecWebhookSubscriptions {
6060
})
6161
}
6262
}
63+
'UnsubscribeAll' {
64+
$TenantList = Get-Tenants -IncludeErrors
65+
$Results = foreach ($tenant in $TenantList) {
66+
$TenantFilter = $tenant.defaultDomainName
67+
$Subscriptions = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscriptions' -tenantid $TenantFilter | Where-Object { $_.notificationUrl -like '*PublicWebhooks*' }
68+
"Unsubscribing from all CIPP subscriptions for $TenantFilter - $($Subscriptions.Count) subscriptions found"
69+
$Subscriptions | ForEach-Object {
70+
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/subscriptions/$($_.id)" -tenantid $TenantFilter -type DELETE -body {} -Verbose
71+
# get row from table if exists and remove
72+
$Webhook = Get-AzDataTableEntity @Table -Filter "WebhookNotificationUrl eq 'https://graph.microsoft.com/beta/subscriptions/$($_.id)'" -Property PartitionKey, RowKey, ETag
73+
if ($Webhook) {
74+
$null = Remove-AzDataTableEntity -Force @Table -Entity $Webhook
75+
}
76+
}
77+
}
78+
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
79+
StatusCode = [HttpStatusCode]::OK
80+
Body = @{ Results = $Results }
81+
})
82+
}
6383
'Resubscribe' {
6484
Write-Host "Resubscribing to $($Request.Query.WebhookID)"
6585
$Row = Get-AzDataTableEntity @Table -Filter "RowKey eq '$($Request.Query.WebhookID)'"

Diff for: Modules/CIPPCore/Public/GraphRequests/Get-GraphRequestList.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function Get-GraphRequestList {
190190
TenantFilter = $_.defaultDomainName
191191
Endpoint = $using:Endpoint
192192
Parameters = $using:Parameters
193-
NoPagination = $using:NoPagination.IsPresent
193+
NoPagination = $false
194194
ReverseTenantLookupProperty = $using:ReverseTenantLookupProperty
195195
ReverseTenantLookup = $using:ReverseTenantLookup.IsPresent
196196
NoAuthCheck = $using:NoAuthCheck.IsPresent

Diff for: Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ function Invoke-CIPPStandardsRun {
1212
$runManually = $false
1313

1414
)
15-
Write-Host "Starting process for standards - $($tenantFilter)"
15+
Write-Host "Starting process for standards - $($tenantFilter). TemplateID: $($TemplateID) RunManually: $($runManually) Force: $($Force.IsPresent)"
1616

1717
$AllTasks = Get-CIPPStandards
1818

1919
if ($Force.IsPresent) {
2020
Write-Host 'Clearing Rerun Cache'
21-
foreach ($Task in $AllTasks) {
22-
Write-Host "Clearing $($Task.Standard)_$($TemplateID)"
23-
$null = Test-CIPPRerun -Type Standard -Tenant $Task.Tenant -API "$($Task.Standard)_$($TemplateID)" -Clear
24-
}
21+
Test-CIPPRerun -ClearAll -TenantFilter $TenantFilter -Type 'Standard'
2522
}
2623

2724
#For each item in our object, run the queue.

Diff for: Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ function Get-CIPPStandards {
1313
$Table = Get-CippTable -tablename 'templates'
1414
$Filter = "PartitionKey eq 'StandardsTemplateV2'"
1515
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter | Sort-Object TimeStamp).JSON | ForEach-Object {
16-
#in the string $_, replace the word 'action' by the word 'Action'.
1716
try {
18-
$_ -replace 'Action', 'action' | ConvertFrom-Json -InputObject $_ -ErrorAction SilentlyContinue
17+
$JSON = ($_).replace('"Action":', '"action":') #fix cap mistake of antique standards
18+
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
1919
} catch {
2020
}
2121
} | Where-Object {

Diff for: Modules/CIPPCore/Public/Test-CIPPRerun.ps1

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ function Test-CIPPRerun {
66
$API,
77
$Settings,
88
$ExecutingUser,
9-
[switch]$Clear
9+
[switch]$Clear,
10+
[switch]$ClearAll
1011
)
1112
$RerunTable = Get-CIPPTable -tablename 'RerunCache'
1213
$EstimatedDifference = switch ($Type) {
@@ -19,6 +20,12 @@ function Test-CIPPRerun {
1920

2021
try {
2122
$RerunData = Get-CIPPAzDataTableEntity @RerunTable -filter "PartitionKey eq '$($TenantFilter)' and RowKey eq '$($Type)_$($API)'"
23+
if ($ClearAll.IsPresent) {
24+
$AllRerunData = Get-CIPPAzDataTableEntity @RerunTable
25+
Remove-AzDataTableEntity @RerunTable -Entity $AllRerunData -Force
26+
return $false
27+
}
28+
2229
if ($Clear.IsPresent) {
2330
if ($RerunData) {
2431
Remove-AzDataTableEntity @RerunTable -Entity $RerunData

Diff for: version_latest.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.0
1+
7.1.2

0 commit comments

Comments
 (0)