Skip to content

Commit

Permalink
Fixes for null assignment in authentication policy
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Oct 11, 2023
1 parent 6c602f6 commit 0f8503b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change log for Microsoft365DSC

# UNRELEASED

* AADAuthenticationMethodPolicyAuthenticator
* Fixes an issue with the Get method when an assigned group
was deleted.

# 1.23.1011.1

* AADRoleEligibilityScheduleRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,12 @@ function Get-TargetResource
$myExcludeTargets = @{}
if ($currentExcludeTargets.id -ne 'all_users')
{
$myExcludeTargetsDisplayName = Get-MgGroup -GroupId $currentExcludeTargets.id
$myExcludeTargets.Add('Id', $myExcludeTargetsDisplayName.DisplayName)
$myExcludeTargetsDisplayName = Get-MgGroup -GroupId $currentExcludeTargets.id -ErrorAction SilentlyContinue

if ($null -ne $myIncludeTargetsDisplayName)
{
$myExcludeTargets.Add('Id', $myExcludeTargetsDisplayName.DisplayName)
}
}
else
{
Expand All @@ -271,8 +275,11 @@ function Get-TargetResource
$myIncludeTargets = @{}
if ($currentIncludeTargets.id -ne 'all_users')
{
$myIncludeTargetsDisplayName = Get-MgGroup -GroupId $currentIncludeTargets.id
$myIncludeTargets.Add('Id', $myIncludeTargetsDisplayName.DisplayName)
$myIncludeTargetsDisplayName = Get-MgGroup -GroupId $currentIncludeTargets.id -ErrorAction SilentlyContinue
if ($null -ne $myIncludeTargetsDisplayName)
{
$myIncludeTargets.Add('Id', $myIncludeTargetsDisplayName.DisplayName)
}
}
else
{
Expand Down

0 comments on commit 0f8503b

Please sign in to comment.