Skip to content

Commit 089fb34

Browse files
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into dev
2 parents 35895bd + 285268e commit 089fb34

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Modules/CIPPCore/Public/Set-CIPPSAMAdminRoles.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ function Set-CIPPSAMAdminRoles {
2020
$SAMRolesTable = Get-CIPPTable -tablename 'SAMRoles'
2121
$Roles = Get-CIPPAzDataTableEntity @SAMRolesTable
2222

23-
$SAMRoles = $Roles.Roles | ConvertFrom-Json
24-
$Tenants = $Roles.Tenants | ConvertFrom-Json
25-
if ($Tenants.value) {
26-
$Tenants = $Tenants.value
23+
try {
24+
$SAMRoles = $Roles.Roles | ConvertFrom-Json -ErrorAction Stop
25+
$Tenants = $Roles.Tenants | ConvertFrom-Json -ErrorAction Stop
26+
if ($Tenants.value) {
27+
$Tenants = $Tenants.value
28+
}
29+
} catch {
30+
$ActionLogs.Add('CIPP-SAM roles not configured')
31+
return $ActionLogs
2732
}
2833

2934
if (($SAMRoles | Measure-Object).count -gt 0 -and $Tenants -contains $TenantFilter -or $Tenants -contains 'AllTenants') {

0 commit comments

Comments
 (0)