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

Fixes #2708 #2737

Merged
merged 1 commit into from
Jan 3, 2023
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 @@ -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