Skip to content

Commit

Permalink
Merge pull request #253 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
JohnDuprey authored Oct 16, 2024
2 parents 1342243 + 0a950f4 commit 3b28e7d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 10 deletions.
23 changes: 23 additions & 0 deletions Modules/CIPPCore/Public/AuditLogs/Remove-CippAuditLogSearch.ps1
Original file line number Diff line number Diff line change
@@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 @{
Expand All @@ -31,4 +32,4 @@ Function Invoke-AddStandardsTemplate {
Body = $body
})

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Modules/CIPPCore/Public/Invoke-RemoveStandardTemplate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
6 changes: 2 additions & 4 deletions Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.1
6.5.2

0 comments on commit 3b28e7d

Please sign in to comment.