Skip to content

Commit

Permalink
fix Remove role wrong cmdlet used
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrola committed Apr 24, 2024
1 parent d4e772d commit bcf9280
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ function Set-TargetResource
elseif ($diff.SideIndicator -eq '<=')
{
Write-Verbose -Message "Removing new member {$($diff.InputObject)} to AAD Group {$($currentGroup.DisplayName)}"
$memberObject = @{
'@odata.id' = "https://graph.microsoft.com/v1.0/users/{$($user.Id)}"
}
Remove-MgGroupMemberDirectoryObjectByRef -GroupId ($currentGroup.Id) -DirectoryObjectId ($user.Id) | Out-Null
}
}
Expand Down Expand Up @@ -833,7 +836,7 @@ function Set-TargetResource
elseif ($diff.SideIndicator -eq '<=')
{
Write-Verbose -Message "Removing AAD group {$($currentGroup.DisplayName)} from Directory Role {$($role.DisplayName)}"
Remove-MgBetaDirectoryRoleMemberByRef -DirectoryRoleId ($role.Id) -DirectoryObjectId ($currentGroup.Id) | Out-Null
Remove-MgBetaDirectoryRoleMemberDirectoryObjectByRef -DirectoryRoleId ($role.Id) -DirectoryObjectId ($currentGroup.Id) | Out-Null
}
}
}
Expand Down

0 comments on commit bcf9280

Please sign in to comment.