Skip to content

Commit bd57189

Browse files
Merge pull request KelvinTegelaar#992 from KelvinTegelaar/dev
Dev to hotfix
2 parents af19f65 + b1736a1 commit bd57189

108 files changed

Lines changed: 1179 additions & 691 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Modules/CIPPCore/CIPPCore.psm1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ $Functions = $Public + $Private
44
foreach ($import in @($Functions)) {
55
try {
66
. $import.FullName
7-
}
8-
catch {
7+
} catch {
98
Write-Error -Message "Failed to import function $($import.FullName): $_"
109
}
1110
}

Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ function Add-CIPPApplicationPermission {
4141
$counter = 0
4242
foreach ($Grant in $Grants) {
4343
try {
44-
$SettingsRequest = New-GraphPOSTRequest -body ($Grant | ConvertTo-Json) -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignedTo" -tenantid $Tenantfilter -type POST -NoAuthCheck $true
44+
$SettingsRequest = New-GraphPOSTRequest -body (ConvertTo-Json -InputObject $Grant -Depth 5) -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignedTo" -tenantid $Tenantfilter -type POST -NoAuthCheck $true
4545
$counter++
4646
} catch {
47-
$Results.add("Failed to grant $($Grant.appRoleId) to $($Grant.resourceId): $($_.Exception.Message)") | Out-Null
47+
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
48+
$Results.add("Failed to grant $($Grant.appRoleId) to $($Grant.resourceId): $ErrorMessage") | Out-Null
4849
}
4950
}
5051
"Added $counter Application permissions to $($ourSVCPrincipal.displayName)"

Modules/CIPPCore/Public/Add-CIPPAzDataTableEntity.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ function Add-CIPPAzDataTableEntity {
134134
}
135135

136136
} catch {
137-
throw "Error processing entity: $($_.Exception.Message) Linenumner: $($_.InvocationInfo.ScriptLineNumber)"
137+
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
138+
throw "Error processing entity: $ErrorMessage Linenumber: $($_.InvocationInfo.ScriptLineNumber)"
138139
}
139140
} else {
140141
Write-Information "THE ERROR IS $($_.Exception.ErrorCode). The size of the entity is $entitySize."

Modules/CIPPCore/Public/Add-CIPPBPAField.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ function Add-CIPPBPAField {
3030
$Result["$fieldName"] = [bool]$FieldValue
3131
}
3232
'JSON' {
33-
if ($FieldValue -eq $null) { $JsonString = '{}' } else { $JsonString = (ConvertTo-Json -Depth 15 -InputObject $FieldValue -Compress) }
33+
if ($null -eq $FieldValue) { $JsonString = '{}' } else { $JsonString = (ConvertTo-Json -Depth 15 -InputObject $FieldValue -Compress) }
3434
$Result[$fieldName] = [string]$JsonString
3535
}
3636
'string' {
3737
$Result[$fieldName], [string]$FieldValue
3838
}
3939
}
4040
Add-CIPPAzDataTableEntity @Table -Entity $Result -Force
41-
}
41+
}

Modules/CIPPCore/Public/Add-CIPPScheduledTask.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ function Add-CIPPScheduledTask {
7272
try {
7373
Add-CIPPAzDataTableEntity @Table -Entity $entity -Force
7474
} catch {
75-
return "Could not add task: $($_.Exception.Message)"
75+
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
76+
return "Could not add task: $ErrorMessage"
7677
}
7778
return "Successfully added task: $($entity.Name)"
7879
}

Modules/CIPPCore/Public/AdditionalPermissions.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,5 @@
22
{
33
"resourceAppId": "00000003-0000-0ff1-ce00-000000000000",
44
"resourceAccess": [{ "id": "AllProfiles.Manage", "type": "Scope" }]
5-
},
6-
{
7-
"resourceAppId": "fb78d390-0c51-40cd-8e17-fdbfab77341b",
8-
"resourceAccess": [
9-
{ "id": "AdminApi.AccessAsUser.All", "type": "Scope" },
10-
{ "id": "FfoPowerShell.AccessAsUser.All", "type": "Scope" },
11-
{ "id": "RemotePowerShell.AccessAsUser.All", "type": "Scope" },
12-
{ "id": "VivaFeatureAccessPolicy.Manage.All", "type": "Scope" }
13-
]
145
}
156
]

Modules/CIPPCore/Public/Assert-CippVersion.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ function Assert-CippVersion {
2424
OutOfDateCIPP = ([version]$RemoteCIPPVersion -gt [version]$CIPPVersion)
2525
OutOfDateCIPPAPI = ([version]$RemoteAPIVersion -gt [version]$APIVersion)
2626
}
27-
}
27+
}

Modules/CIPPCore/Public/Clear-CippDurables.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ function Clear-CippDurables {
5959
}
6060
$null = Get-CippTable -TableName ('{0}History' -f $FunctionName)
6161
Write-Information 'Durable Orchestrators and Queues have been cleared'
62-
}
62+
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Function Invoke-ExecSetCIPPAutoBackup {
1919
}
2020
Remove-AzDataTableEntity @Table -Entity $task | Out-Null
2121

22-
$TaskBody = @{
22+
$TaskBody = [pscustomobject]@{
2323
TenantFilter = 'AllTenants'
2424
Name = 'Automated CIPP Backup'
2525
Command = @{
2626
value = 'New-CIPPBackup'
2727
label = 'New-CIPPBackup'
2828
}
29-
Parameters = @{ backupType = 'CIPP' }
29+
Parameters = [pscustomobject]@{ backupType = 'CIPP' }
3030
ScheduledTime = $unixtime
3131
Recurrence = '1d'
3232
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-AddScheduledItem.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Function Invoke-AddScheduledItem {
99
#>
1010
[CmdletBinding()]
1111
param($Request, $TriggerMetadata)
12-
if ($Request.query.hidden -eq $null) {
12+
if ($null -eq $Request.query.hidden) {
1313
$hidden = $false
1414
} else {
1515
$hidden = $true

0 commit comments

Comments
 (0)