forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from KelvinTegelaar/master
[pull] master from KelvinTegelaar:master
- Loading branch information
Showing
125 changed files
with
1,786 additions
and
1,045 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action | ||
# More GitHub Actions for Azure: https://github.com/Azure/actions | ||
|
||
name: Build and deploy Powershell project to Azure Function App - cippacnqv | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
workflow_dispatch: | ||
|
||
env: | ||
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root | ||
|
||
jobs: | ||
deploy: | ||
runs-on: windows-latest | ||
permissions: | ||
id-token: write #This is required for requesting the JWT | ||
|
||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to Azure | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6085081ED1124B799258E9FF743FF4B9 }} | ||
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_9BDB2DDBFAFA4BC19C20A58B204BFAF3 }} | ||
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_02B5224812794971B05EDD557AF2B867 }} | ||
|
||
- name: 'Run Azure Functions Action' | ||
uses: Azure/functions-action@v1 | ||
id: fa | ||
with: | ||
app-name: 'cippacnqv' | ||
slot-name: 'Production' | ||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
.../CIPPCore/Public/Entrypoints/Activity Triggers/Webhooks/Push-AuditLogBundleProcessing.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
function Push-AuditLogBundleProcessing { | ||
Param($Item) | ||
|
||
try { | ||
$AuditBundleTable = Get-CippTable -tablename 'AuditLogBundles' | ||
$AuditLogBundle = Get-CIPPAzDataTableEntity @AuditBundleTable -Filter "PartitionKey eq '$($Item.TenantFilter)' and RowKey eq '$($Item.ContentId)'" | ||
if ($AuditLogBundle.ProcessingStatus -ne 'Pending') { | ||
Write-Information 'Audit log bundle already processed' | ||
return | ||
} | ||
try { | ||
$AuditLogTest = Test-CIPPAuditLogRules -TenantFilter $Item.TenantFilter -LogType $AuditLogBundle.ContentType -ContentUri $AuditLogBundle.ContentUri | ||
$AuditLogBundle.ProcessingStatus = 'Completed' | ||
$AuditLogBundle.MatchedRules = [string](ConvertTo-Json -Compress -Depth 10 -InputObject $AuditLogTest.MatchedRules) | ||
$AuditLogBundle.MatchedLogs = $AuditLogTest.MatchedLogs | ||
} catch { | ||
$AuditLogBundle.ProcessingStatus = 'Failed' | ||
$AuditLogBundle | Add-Member -NotePropertyName Error -NotePropertyValue $_.InvocationInfo.PositionMessage -TypeName string | ||
} | ||
try { | ||
Add-CIPPAzDataTableEntity @AuditBundleTable -Entity $AuditLogBundle -Force | ||
} catch { | ||
Write-Host ( 'Error logging audit bundle: {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message) | ||
} | ||
|
||
$DataToProcess = ($AuditLogTest).DataToProcess | ||
Write-Information "Webhook: Data to process found: $($DataToProcess.count) items" | ||
foreach ($AuditLog in $DataToProcess) { | ||
Write-Information "Processing $($AuditLog.operation)" | ||
$Webhook = @{ | ||
Data = $AuditLog | ||
CIPPURL = [string]$AuditLogBundle.CIPPURL | ||
TenantFilter = $Item.TenantFilter | ||
} | ||
Invoke-CippWebhookProcessing @Webhook | ||
} | ||
} catch { | ||
Write-Host ( 'Audit log error {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message) | ||
} | ||
} |
Oops, something went wrong.