From eeb906869060b4fdad000d46d28c851ae82c840b Mon Sep 17 00:00:00 2001 From: John Duprey Date: Sat, 12 Oct 2024 09:59:00 -0400 Subject: [PATCH 1/3] up version --- version_latest.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version_latest.txt b/version_latest.txt index a194c18e86e8..fa09f584d78e 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -6.5.1 +6.5.2 \ No newline at end of file From b575d25dbcea202c83157114091fd37d381da9f0 Mon Sep 17 00:00:00 2001 From: Esco Date: Mon, 7 Oct 2024 10:58:34 +0200 Subject: [PATCH 2/3] fix: InTune Compliance Policy deployment --- Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 b/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 index 96959041a08f..f2d429fc5127 100644 --- a/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1 @@ -35,10 +35,10 @@ function Set-CIPPIntunePolicy { $JSON = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty id, createdDateTime, lastModifiedDateTime, version, 'scheduledActionsForRule@odata.context', '@odata.context' $JSON.scheduledActionsForRule = @($JSON.scheduledActionsForRule | Select-Object * -ExcludeProperty 'scheduledActionConfigurations@odata.context') if ($displayname -in $CheckExististing.displayName) { - $RawJSON = ConvertTo-Json -InputObject $JSON -Depth 20 -Compress + $RawJSON = ConvertTo-Json -InputObject ($JSON | Select-Object * -ExcludeProperty 'scheduledActionsForRule') -Depth 20 -Compress $PostType = 'edited' $ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname - $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PUT -body $RawJSON + $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' $CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName } else { @@ -81,9 +81,7 @@ function Set-CIPPIntunePolicy { $CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter if ($PolicyFile.displayName -in $CheckExististing.displayName) { $PostType = 'edited' - Write-Host 'hit' $ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName - Write-Host "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" $CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON $CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info' From fe5930144cf28ea7d844da955320ae8d010a1c94 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Mon, 14 Oct 2024 13:25:03 +0200 Subject: [PATCH 3/3] update delete template --- .../AuditLogs/Remove-CippAuditLogSearch.ps1 | 23 +++++++++++++++++++ .../Standards/Invoke-AddStandardsTemplate.ps1 | 7 +++--- .../Invoke-listStandardTemplates.ps1 | 3 ++- .../Public/Invoke-RemoveStandardTemplate.ps1 | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 Modules/CIPPCore/Public/AuditLogs/Remove-CippAuditLogSearch.ps1 diff --git a/Modules/CIPPCore/Public/AuditLogs/Remove-CippAuditLogSearch.ps1 b/Modules/CIPPCore/Public/AuditLogs/Remove-CippAuditLogSearch.ps1 new file mode 100644 index 000000000000..39457758e848 --- /dev/null +++ b/Modules/CIPPCore/Public/AuditLogs/Remove-CippAuditLogSearch.ps1 @@ -0,0 +1,23 @@ +function Remove-CippAuditLogSearch { + <# + .SYNOPSIS + Get the results of an audit log search + .DESCRIPTION + Get the results of an audit log search from the Graph API + .PARAMETER TenantFilter + The tenant to filter on. + .PARAMETER QueryId + The ID of the query to get the results for. + #> + param ( + [Parameter(Mandatory = $true)] + [string]$TenantFilter, + [Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true)] + [Alias('id')] + [string]$QueryId + ) + + process { + New-GraphPostRequest -type DELETE -body '{}' -uri ('https://graph.microsoft.com/beta/security/auditLog/queries/{0}' -f $QueryId) -AsApp $true -tenantid $TenantFilter + } +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 index 8e5186727b8f..66f0402b0171 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-AddStandardsTemplate.ps1 @@ -12,8 +12,9 @@ Function Invoke-AddStandardsTemplate { $APIName = $TriggerMetadata.FunctionName Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug' - $GUID = (New-Guid).GUID - $JSON = (ConvertTo-Json -Depth 100 -InputObject ($Request.body | Select-Object standards, name)) + + $GUID = $Request.body.GUID ? $request.body.GUID : (New-Guid).GUID + $JSON = (ConvertTo-Json -Depth 100 -InputObject ($Request.body)) $Table = Get-CippTable -tablename 'templates' $Table.Force = $true Add-CIPPAzDataTableEntity @Table -Entity @{ @@ -31,4 +32,4 @@ Function Invoke-AddStandardsTemplate { Body = $body }) -} \ No newline at end of file +} diff --git a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 index 1b17d33131a2..b866f1f814a0 100644 --- a/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-listStandardTemplates.ps1 @@ -18,8 +18,9 @@ Function Invoke-listStandardTemplates { $data = $_.JSON | ConvertFrom-Json -Depth 100 $data | Add-Member -NotePropertyName 'GUID' -NotePropertyValue $_.GUID -Force $data - } | Sort-Object -Property displayName + } | Sort-Object -Property templateName + if ($Request.query.id) { $Templates = $Templates | Where-Object GUID -EQ $Request.query.id } # Associate values to output bindings by calling 'Push-OutputBinding'. Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ StatusCode = [HttpStatusCode]::OK diff --git a/Modules/CIPPCore/Public/Invoke-RemoveStandardTemplate.ps1 b/Modules/CIPPCore/Public/Invoke-RemoveStandardTemplate.ps1 index d00b4da7bffa..a60e7fe39b3f 100644 --- a/Modules/CIPPCore/Public/Invoke-RemoveStandardTemplate.ps1 +++ b/Modules/CIPPCore/Public/Invoke-RemoveStandardTemplate.ps1 @@ -14,7 +14,7 @@ Function Invoke-RemoveStandardTemplate { $User = $request.headers.'x-ms-client-principal' Write-LogMessage -user $User -API $APINAME -message 'Accessed this API' -Sev 'Debug' - $ID = $request.query.ID + $ID = $request.body.ID try { $Table = Get-CippTable -tablename 'templates'