File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ function Add-CIPPDelegatedPermission {
114114 $OldScope = ($CurrentDelegatedScopes | Where-Object - Property Resourceid -EQ $svcPrincipalId.id )
115115
116116 if (! $OldScope ) {
117+ if ([string ]::IsNullOrEmpty($NewScope ) -or $NewScope -eq ' ' ) {
118+ $Results.add (" No delegated permissions to add for $ ( $svcPrincipalId.displayName ) " )
119+ continue
120+ }
117121 try {
118122 $Createbody = @ {
119123 clientId = $ourSVCPrincipal.id
@@ -147,6 +151,13 @@ function Add-CIPPDelegatedPermission {
147151 $Results.add (" All delegated permissions exist for $ ( $svcPrincipalId.displayName ) " )
148152 continue
149153 }
154+
155+ if ([string ]::IsNullOrEmpty($NewScope ) -or $NewScope -eq ' ' ) {
156+ # No permissions to update
157+ $Results.add (" No delegated permissions to update for $ ( $svcPrincipalId.displayName ) " )
158+ continue
159+ }
160+
150161 $Patchbody = @ {
151162 scope = " $NewScope "
152163 } | ConvertTo-Json - Compress
You can’t perform that action at this time.
0 commit comments