Skip to content

Commit

Permalink
Merge pull request #5425 from ykuijs/Dev
Browse files Browse the repository at this point in the history
Fix issues in AADRoleSettings and TeamsUpdateManagementPolicy
  • Loading branch information
NikCharlebois authored Nov 19, 2024
2 parents 1a5aa18 + e57c4e7 commit 85dc44e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
* Initial release.
* AADRoleEligibilityScheduleRequest
* Adds support for custom role assignments at app scope.
* AADRoleSettings
* Fixing issue where the ActivateApprover parameter isn't processed correctly
when an approver does not exist.
FIXES [#5423](https://github.com/microsoft/Microsoft365DSC/issues/5423)
FIXES [#5415](https://github.com/microsoft/Microsoft365DSC/issues/5415)
* AzureBillingAccountPolicy
* Initial release.
Expand All @@ -59,6 +63,10 @@
FIXES [#5411](https://github.com/microsoft/Microsoft365DSC/issues/5411)
* IntuneFirewallRulesHyperVPolicyWindows10
* Initial release.
* TeamsUpdateManagementPolicy
* Added conversion of the UpdateTimeOfDay parameter to the local culture format
so that the comparison will work consistently.
FIXES [#5424](https://github.com/microsoft/Microsoft365DSC/issues/5424)
* M365DSCDRGUtil
* Improve CIM instance detection for specific Intune resources.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,15 +968,8 @@ function Set-TargetResource
{
#is not a guid try with user
$Filter = "UserPrincipalName eq '" + $item + "'"
try
{
$user = Get-MgUser -Filter $Filter -ErrorAction Stop
}
catch
{
Write-Verbose -Message 'User not found, try with group'
}
if ($user.length -gt 0)
$user = Get-MgUser -Filter $Filter
if ($null -ne $user)
{
$ActivateApprovers = @{}
$ActivateApprovers.Add('@odata.type', '#microsoft.graph.singleUser')
Expand All @@ -986,24 +979,22 @@ function Set-TargetResource
}
else
{
#try with group
Write-Verbose -Message "User '$item' not found, trying with group"

$Filter = "displayName eq '" + $item + "'"
try
{
$group = Get-MgGroup -Filter $Filter -ErrorAction Stop
}
catch
{
Write-Verbose -Message 'Group not found'
}
if ($group.length -gt 0)
$group = Get-MgGroup -Filter $Filter
if ($null -ne $group)
{
$ActivateApprovers = @{}
$ActivateApprovers.Add('@odata.type', '#microsoft.graph.groupMembers')
$ActivateApprovers.Add('groupId', $group.Id)
$primaryApprovers += $ActivateApprovers
$group = $null
}
else
{
throw "Group '$item' not found. Cannot add as approver."
}
}
}
}
Expand All @@ -1012,6 +1003,7 @@ function Set-TargetResource
$approvalStages.Add('isApproverJustificationRequired', 'true')
$approvalStages.Add('escalationTimeInMinutes', '0')
$approvalStages.Add('isEscalationEnabled', 'False')

if ($primaryApprovers.Count -gt 0)
{
$approvalStages.Add('primaryApprovers', @($primaryApprovers))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,14 @@ function Test-TargetResource

$ValuesToCheck = Remove-M365DSCAuthenticationParameter -BoundParameters $ValuesToCheck

if ($PSBoundParameters.ContainsKey('UpdateTimeOfDay'))
{
Write-Verbose -Message "Converting UpdateTimeOfDay ($UpdateTimeOfDay) to the current culture format"
$dtUpdateTimeOfDay = [datetime]::Parse($PSBoundParameters.UpdateTimeOfDay)
$PSBoundParameters.UpdateTimeOfDay = $dtUpdateTimeOfDay.ToShortTimeString()
Write-Verbose -Message " Converted value $($PSBoundParameters.UpdateTimeOfDay))"
}

Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $PSBoundParameters)"

Expand Down

0 comments on commit 85dc44e

Please sign in to comment.