Skip to content

Commit

Permalink
Merge pull request #3899 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.23.1108.3
  • Loading branch information
NikCharlebois authored Nov 14, 2023
2 parents 7840ef9 + 281640f commit c4e8923
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change log for Microsoft365DSC

# 1.23.1108.2
# 1.23.1108.3

* AADRoleEligibilityScheduleRequest
* Fixed incorrect subclass MSFT_AADRoleEligibilityScheduleRequestScheduleRecurrenceRange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@
{
if ($null -ne $Script:exportedInstances -and $Script:ExportMode)
{
[Array]$request = $Script:exportedInstances | Where-Object -FilterScript {$_.Id -eq $Id}
$request = $Script:exportedInstances | Where-Object -FilterScript {$_.Id -eq $Id}
}
else
{
Write-Verbose -Message "Getting Role Eligibility by Id {$Id}"
[Array]$request = Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleRequest -UnifiedRoleEligibilityScheduleRequestId $Id `
$request = Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleRequest -UnifiedRoleEligibilityScheduleRequestId $Id `
-ErrorAction SilentlyContinue
}
}

if ($null -eq $request -or $request.Length -eq 0)
if ($null -eq $request)
{
if ($null -ne $Script:exportedInstances -and $Script:ExportMode)
{
Expand All @@ -146,7 +146,7 @@
}
Write-Verbose -Message "Found Principal {$PrincipalId}"
$RoleDefinitionId = (Get-MgBetaRoleManagementDirectoryRoleDefinition -Filter "DisplayName eq '$RoleDefinition'").Id
[Array]$request = $Script:exportedInstances | Where-Object -FilterScript {$_.PrincipalId -eq $PrincipalId -and $_.RoleDefinitionId -eq $RoleDefinition}
$request = $Script:exportedInstances | Where-Object -FilterScript {$_.PrincipalId -eq $PrincipalId -and $_.RoleDefinitionId -eq $RoleDefinition}
}
else
{
Expand Down Expand Up @@ -178,28 +178,34 @@
Write-Verbose -Message "Found Role {$RoleDefinitionId}"

$schedule = Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule -Filter "PrincipalId eq '$PrincipalId' and RoleDefinitionId eq '$RoleDefinitionId'"
[Array]$request = Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleRequest -Filter "PrincipalId eq '$PrincipalId' and RoleDefinitionId eq '$RoleDefinitionId'"
$request = Get-MgBetaRoleManagementDirectoryRoleEligibilityScheduleRequest -Filter "PrincipalId eq '$PrincipalId' and RoleDefinitionId eq '$RoleDefinitionId'"
}
}
else
{
$RoleDefinitionId = (Get-MgBetaRoleManagementDirectoryRoleDefinition -Filter "DisplayName eq '$RoleDefinition'").Id
$schedule = Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule -Filter "PrincipalId eq '$($request[0].PrincipalId)' and RoleDefinitionId eq '$RoleDefinitionId'"
$schedule = Get-MgBetaRoleManagementDirectoryRoleEligibilitySchedule -Filter "PrincipalId eq '$($request.PrincipalId)' and RoleDefinitionId eq '$RoleDefinitionId'"
}
if ($null -eq $schedule -or $null -eq $request -or $request.Length -eq 0)
if ($null -eq $schedule -or $null -eq $request)
{
return $nullResult
}

Write-Verbose -Message "Found existing AADRolelLigibilityScheduleRequest"
if ($PrincipalType -eq 'User')
{
$PrincipalInstance = Get-MgUser -UserId $request[0].PrincipalId -ErrorAction SilentlyContinue
$PrincipalInstance = Get-MgUser -UserId $request.PrincipalId -ErrorAction SilentlyContinue
$PrincipalTypeValue = 'User'
}
if ($null -eq $PrincipalInstance -or $PrincipalType -eq 'Group')
{
$PrincipalInstance = Get-MGGroup -GroupId $request[0].PrincipalId -ErrorAction SilentlyContinue
$requestArray = [Array]$request
if ($requestArray.Count -gt 1)
{
$requestArray = $requestArray | Sort-Object -Property CreatedDateTime -Descending
$request = $requestArray[0]
}
$PrincipalInstance = Get-MGGroup -GroupId $request.PrincipalId -ErrorAction SilentlyContinue
$PrincipalTypeValue = 'Group'
}

Expand Down Expand Up @@ -250,11 +256,11 @@
}

$ticketInfoValue = $null
if ($null -ne $request[0].TicketInfo)
if ($null -ne $request.TicketInfo)
{
$ticketInfoValue = @{
ticketNumber = $request[0].TicketInfo.TicketNumber
ticketSystem = $request[0].TicketInfo.TicketSystem
ticketNumber = $request.TicketInfo.TicketNumber
ticketSystem = $request.TicketInfo.TicketSystem
}
}

Expand All @@ -272,12 +278,12 @@
Principal = $PrincipalValue
PrincipalType = $PrincipalTypeValue
RoleDefinition = $RoleDefinition
DirectoryScopeId = $request[0].DirectoryScopeId
AppScopeId = $request[0].AppScopeId
Action = $request[0].Action
Id = $request[0].Id
Justification = $request[0].Justification
IsValidationOnly = $request[0].IsValidationOnly
DirectoryScopeId = $request.DirectoryScopeId
AppScopeId = $request.AppScopeId
Action = $request.Action
Id = $request.Id
Justification = $request.Justification
IsValidationOnly = $request.IsValidationOnly
ScheduleInfo = $ScheduleInfoValue
TicketInfo = $ticketInfoValue
Ensure = 'Present'
Expand Down
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Microsoft365DSC.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.23.1108.2'
ModuleVersion = '1.23.1108.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down

0 comments on commit c4e8923

Please sign in to comment.