Skip to content

Commit

Permalink
improvements createbackup
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Jul 4, 2024
1 parent d633ad7 commit 169cf66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Modules/CIPPCore/Public/New-CIPPBackup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ function New-CIPPBackup {
RowKey = $RowKey
TenantFilter = $TenantFilter
}
Write-Host "ScheduledBackupValues: $($ScheduledBackupValues | ConvertTo-Json -Compress -Depth 100)"
Write-Host "Scheduled backup value psproperties: $($ScheduledBackupValues.psobject.Properties.Name)"
foreach ($ScheduledBackup in $ScheduledBackupValues.psobject.Properties.Name) {
$entity[$ScheduledBackup] = New-CIPPBackupTask -Task $ScheduledBackup -TenantFilter $TenantFilter
}

$Table = Get-CippTable -tablename 'ScheduledBackup'
try {
$Result = Add-CIPPAzDataTableEntity @Table -entity $entity -Force
Expand Down
20 changes: 10 additions & 10 deletions Modules/CIPPCore/Public/New-CIPPBackupTask.ps1
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
function New-CIPPBackupTask {
[CmdletBinding()]
param (
$ScheduledBackup,
$Task,
$TenantFilter
)

$BackupData = switch ($ScheduledBackup) {
$BackupData = switch ($Task) {
'users' {
New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/users?$top=999' -tenantid $TenantFilter
$BackupData = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/users?$top=999' -tenantid $TenantFilter
}
'groups' {
New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/groups?$top=999' -tenantid $TenantFilter
$BackupData = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/groups?$top=999' -tenantid $TenantFilter
}
'ca' {
New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/conditionalAccess/policies?$top=999' -tenantid $TenantFilter
$BackupData = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/conditionalAccess/policies?$top=999' -tenantid $TenantFilter
}
'namedlocations' {
New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/conditionalAccess/namedLocations?$top=999' -tenantid $TenantFilter
$BackupData = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/conditionalAccess/namedLocations?$top=999' -tenantid $TenantFilter
}
'authstrengths' {
New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/conditionalAccess/authenticationStrength/policies' -tenantid $TenantFilter
$BackupData = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/conditionalAccess/authenticationStrength/policies' -tenantid $TenantFilter
}
'intuneconfig' {
#alert
Expand All @@ -30,16 +30,16 @@ function New-CIPPBackupTask {

'CippWebhookAlerts' {
$WebhookTable = Get-CIPPTable -TableName 'WebhookRules'
Get-CIPPAzDataTableEntity @WebhookTable | Where-Object { $TenantFilter -in ($_.Tenants | ConvertFrom-Json).fullvalue.defaultDomainName }
$BackupData = Get-CIPPAzDataTableEntity @WebhookTable | Where-Object { $TenantFilter -in ($_.Tenants | ConvertFrom-Json).fullvalue.defaultDomainName }
}
'CippScriptedAlerts' {
$ScheduledTasks = Get-CIPPTable -TableName 'ScheduledTasks'
Get-CIPPAzDataTableEntity @ScheduledTasks | Where-Object { $_.hidden -eq $true -and $_.command -like 'Get-CippAlert*' -and $TenantFilter -in $_.Tenant }
$BackupData = Get-CIPPAzDataTableEntity @ScheduledTasks | Where-Object { $_.hidden -eq $true -and $_.command -like 'Get-CippAlert*' -and $TenantFilter -in $_.Tenant }
}
'CippStandards' {
$Table = Get-CippTable -tablename 'standards'
$Filter = "PartitionKey eq 'standards' and RowKey eq '$($TenantFilter)'"
(Get-CIPPAzDataTableEntity @Table -Filter $Filter)
$BackupData = (Get-CIPPAzDataTableEntity @Table -Filter $Filter)
}

}
Expand Down

0 comments on commit 169cf66

Please sign in to comment.