Skip to content

Commit

Permalink
Merge pull request #2737 from NikCharlebois/Fixes-#2708
Browse files Browse the repository at this point in the history
Fixes #2708
  • Loading branch information
NikCharlebois authored Jan 3, 2023
2 parents 2e8d841 + 7b63f00 commit 9a316f3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# UNRELEASED

* EXOManagementRoleAssignment
* Modified logic to handle the RecipientOrganizationUnitScope parameter by display name.
FIXES [#2708](https://github.com/microsoft/Microsoft365DSC/issues/2708)
* IntuneASRRulesPolicyWindows10
* Corrects possible values for parameter OfficeCommunicationAppsLaunchChildProcess
FIXES [#2730](https://github.com/microsoft/Microsoft365DSC/issues/2730)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,27 @@ function Get-TargetResource
}
else
{
$RecipientAdministrativeUnitScopeValue = $null
if ($roleAssignment.RecipientWriteScope -eq 'AdministrativeUnit')
{
$adminUnit = Get-AdministrativeUnit -Identity $roleAssignment.CustomRecipientWriteScope

if ($RecipientAdministrativeUnitScope -eq $adminUnit.Name)
{
$RecipientAdministrativeUnitScopeValue = $RecipientAdministrativeUnitScope
}
else
{
$RecipientAdministrativeUnitScopeValue = $adminUnit.DisplayName
}
}

$result = @{
Name = $roleAssignment.Name
CustomRecipientWriteScope = $roleAssignment.CustomRecipientWriteScope
CustomResourceScope = $roleAssignment.CustomResourceScope
ExclusiveRecipientWriteScope = $roleAssignment.ExclusiveRecipientWriteScope
RecipientAdministrativeUnitScope = $roleAssignment.RecipientAdministrativeUnitScope
RecipientAdministrativeUnitScope = $RecipientAdministrativeUnitScopeValue
RecipientOrganizationalUnitScope = $roleAssignment.RecipientOrganizationalUnitScope
RecipientRelativeWriteScope = $roleAssignment.RecipientRelativeWriteScope
Role = $roleAssignment.Role
Expand Down Expand Up @@ -295,6 +310,18 @@ function Set-TargetResource
$NewManagementRoleParams.Remove('CertificatePassword') | Out-Null
$NewManagementRoleParams.Remove('ManagedIdentity') | Out-Null

# If the RecipientAdministrativeUnitScope parameter is provided, then retrieve its ID by Name
if (-not [System.String]::IsNullOrEmpty($RecipientAdministrativeUnitScope))
{
$NewManagementRoleParams.Remove("CustomRecipientWriteScope") | Out-Null
$adminUnit = Get-AdministrativeUnit -Identity $RecipientAdministrativeUnitScope -ErrorAction SilentlyContinue
if ($null -eq $adminUnit)
{
$adminUnit = Get-AdministrativeUnit | Where-Object -FilterScript {$_.DisplayName -eq $RecipientAdministrativeUnitScope}
}
$NewManagementRoleParams.RecipientAdministrativeUnitScope = $adminUnit.Name
}

# CASE: Management Role doesn't exist but should;
if ($Ensure -eq 'Present' -and $currentManagementRoleConfig.Ensure -eq 'Absent')
{
Expand Down

0 comments on commit 9a316f3

Please sign in to comment.