@@ -26,11 +26,12 @@ function Invoke-ExecCustomRole {
2626 Write-LogMessage - headers $Request.Headers - API ' ExecCustomRole' - message " Saved custom role $ ( $Request.Body.RoleName ) " - Sev ' Info'
2727 if ($Request.Body.RoleName -notin $DefaultRoles ) {
2828 $Role = @ {
29- ' PartitionKey' = ' CustomRoles'
30- ' RowKey' = " $ ( $Request.Body.RoleName.ToLower ()) "
31- ' Permissions' = " $ ( $Request.Body.Permissions | ConvertTo-Json - Compress) "
32- ' AllowedTenants' = " $ ( $Request.Body.AllowedTenants | ConvertTo-Json - Compress) "
33- ' BlockedTenants' = " $ ( $Request.Body.BlockedTenants | ConvertTo-Json - Compress) "
29+ ' PartitionKey' = ' CustomRoles'
30+ ' RowKey' = " $ ( $Request.Body.RoleName.ToLower ()) "
31+ ' Permissions' = " $ ( $Request.Body.Permissions | ConvertTo-Json - Compress) "
32+ ' AllowedTenants' = " $ ( $Request.Body.AllowedTenants | ConvertTo-Json - Compress) "
33+ ' BlockedTenants' = " $ ( $Request.Body.BlockedTenants | ConvertTo-Json - Compress) "
34+ ' BlockedEndpoints' = " $ ( $Request.Body.BlockedEndpoints | ConvertTo-Json - Compress) "
3435 }
3536 Add-CIPPAzDataTableEntity @Table - Entity $Role - Force | Out-Null
3637 $Results.Add (" Custom role $ ( $Request.Body.RoleName ) saved" )
@@ -110,6 +111,15 @@ function Invoke-ExecCustomRole {
110111 } else {
111112 $Role | Add-Member - NotePropertyName BlockedTenants - NotePropertyValue @ () - Force
112113 }
114+ if ($Role.BlockedEndpoints ) {
115+ try {
116+ $Role.BlockedEndpoints = @ ($Role.BlockedEndpoints | ConvertFrom-Json )
117+ } catch {
118+ $Role.BlockedEndpoints = ' '
119+ }
120+ } else {
121+ $Role | Add-Member - NotePropertyName BlockedEndpoints - NotePropertyValue @ () - Force
122+ }
113123 $EntraRoleGroup = $EntraRoleGroups | Where-Object - Property RowKey -EQ $Role.RowKey
114124 if ($EntraRoleGroup ) {
115125 $EntraGroup = $EntraRoleGroups | Where-Object - Property RowKey -EQ $Role.RowKey | Select-Object @ {Name = ' label' ; Expression = { $_.GroupName } }, @ {Name = ' value' ; Expression = { $_.GroupId } }
@@ -120,10 +130,11 @@ function Invoke-ExecCustomRole {
120130 }
121131 $DefaultRoles = foreach ($DefaultRole in $DefaultRoles ) {
122132 $Role = @ {
123- RowKey = $DefaultRole
124- Permissions = ' '
125- AllowedTenants = @ (' AllTenants' )
126- BlockedTenants = @ (' ' )
133+ RowKey = $DefaultRole
134+ Permissions = ' '
135+ AllowedTenants = @ (' AllTenants' )
136+ BlockedTenants = @ (' ' )
137+ BlockedEndpoints = @ (' ' )
127138 }
128139 $EntraRoleGroup = $EntraRoleGroups | Where-Object - Property RowKey -EQ $Role.RowKey
129140 if ($EntraRoleGroup ) {
0 commit comments