Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AADServicePrincipal - Fix Null Values #5724

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

* AADConditionalAccessPolicy
* Changed the InsiderRiskTypes property to a string array.
* AADServicePrincipal
* Fixes comparison of assigned roles for null values.
FIXES [#5717](https://github.com/microsoft/Microsoft365DSC/issues/5717)
* MISC
* Changed the CIMInstance logic of various resources to us common logic.
* Added support for specifying a proxy in Update-M365DSCModule.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,15 @@ function Set-TargetResource
[Array]$currentPrincipals = $currentAADServicePrincipal.AppRoleAssignedTo.Identity
[Array]$desiredPrincipals = $AppRoleAssignedTo.Identity

if ($null -eq $currentPrincipals)
{
$currentPrincipals = @()
}
if ($null -eq $desiredPrincipals)
{
$desiredPrincipals = @()
}

[Array]$differences = Compare-Object -ReferenceObject $currentPrincipals -DifferenceObject $desiredPrincipals
[Array]$membersToAdd = $differences | Where-Object -FilterScript { $_.SideIndicator -eq '=>' }
[Array]$membersToRemove = $differences | Where-Object -FilterScript { $_.SideIndicator -eq '<=' }
Expand Down