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 @@ -21,10 +21,10 @@ Function Invoke-ExecEditTemplate {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ function Invoke-ListGraphRequest {
$Results = Get-GraphRequestList @GraphRequestParams
if ($Results.nextLink) {
Write-Host "NextLink: $($Results.nextLink | Select-Object -Last 1)"
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
if ($Request.Query.TenantFilter -ne 'AllTenants') {
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
}
#Results is an array of objects, so we need to remove the last object before returning
$Results = $Results | Select-Object -First ($Results.Count - 1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@ function Invoke-ExecWebhookSubscriptions {
})
}
}
'UnsubscribeAll' {
$TenantList = Get-Tenants -IncludeErrors
$Results = foreach ($tenant in $TenantList) {
$TenantFilter = $tenant.defaultDomainName
$Subscriptions = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscriptions' -tenantid $TenantFilter | Where-Object { $_.notificationUrl -like '*PublicWebhooks*' }
"Unsubscribing from all CIPP subscriptions for $TenantFilter - $($Subscriptions.Count) subscriptions found"
$Subscriptions | ForEach-Object {
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/subscriptions/$($_.id)" -tenantid $TenantFilter -type DELETE -body {} -Verbose
# get row from table if exists and remove
$Webhook = Get-AzDataTableEntity @Table -Filter "WebhookNotificationUrl eq 'https://graph.microsoft.com/beta/subscriptions/$($_.id)'" -Property PartitionKey, RowKey, ETag
if ($Webhook) {
$null = Remove-AzDataTableEntity -Force @Table -Entity $Webhook
}
}
}
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = @{ Results = $Results }
})
}
'Resubscribe' {
Write-Host "Resubscribing to $($Request.Query.WebhookID)"
$Row = Get-AzDataTableEntity @Table -Filter "RowKey eq '$($Request.Query.WebhookID)'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function Get-GraphRequestList {
TenantFilter = $_.defaultDomainName
Endpoint = $using:Endpoint
Parameters = $using:Parameters
NoPagination = $using:NoPagination.IsPresent
NoPagination = $false
ReverseTenantLookupProperty = $using:ReverseTenantLookupProperty
ReverseTenantLookup = $using:ReverseTenantLookup.IsPresent
NoAuthCheck = $using:NoAuthCheck.IsPresent
Expand Down
7 changes: 2 additions & 5 deletions Modules/CIPPCore/Public/Invoke-CIPPStandardsRun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@ function Invoke-CIPPStandardsRun {
$runManually = $false

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

$AllTasks = Get-CIPPStandards

if ($Force.IsPresent) {
Write-Host 'Clearing Rerun Cache'
foreach ($Task in $AllTasks) {
Write-Host "Clearing $($Task.Standard)_$($TemplateID)"
$null = Test-CIPPRerun -Type Standard -Tenant $Task.Tenant -API "$($Task.Standard)_$($TemplateID)" -Clear
}
Test-CIPPRerun -ClearAll -TenantFilter $TenantFilter -Type 'Standard'
}

#For each item in our object, run the queue.
Expand Down
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/Standards/Get-CIPPStandards.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ function Get-CIPPStandards {
$Table = Get-CippTable -tablename 'templates'
$Filter = "PartitionKey eq 'StandardsTemplateV2'"
$Templates = (Get-CIPPAzDataTableEntity @Table -Filter $Filter | Sort-Object TimeStamp).JSON | ForEach-Object {
#in the string $_, replace the word 'action' by the word 'Action'.
try {
$_ -replace 'Action', 'action' | ConvertFrom-Json -InputObject $_ -ErrorAction SilentlyContinue
$JSON = ($_).replace('"Action":', '"action":') #fix cap mistake of antique standards
ConvertFrom-Json -InputObject $JSON -ErrorAction SilentlyContinue
} catch {
}
} | Where-Object {
Expand Down
9 changes: 8 additions & 1 deletion Modules/CIPPCore/Public/Test-CIPPRerun.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function Test-CIPPRerun {
$API,
$Settings,
$ExecutingUser,
[switch]$Clear
[switch]$Clear,
[switch]$ClearAll
)
$RerunTable = Get-CIPPTable -tablename 'RerunCache'
$EstimatedDifference = switch ($Type) {
Expand All @@ -19,6 +20,12 @@ function Test-CIPPRerun {

try {
$RerunData = Get-CIPPAzDataTableEntity @RerunTable -filter "PartitionKey eq '$($TenantFilter)' and RowKey eq '$($Type)_$($API)'"
if ($ClearAll.IsPresent) {
$AllRerunData = Get-CIPPAzDataTableEntity @RerunTable
Remove-AzDataTableEntity @RerunTable -Entity $AllRerunData -Force
return $false
}

if ($Clear.IsPresent) {
if ($RerunData) {
Remove-AzDataTableEntity @RerunTable -Entity $RerunData
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.1.0
7.1.2
Loading