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'