Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Dec 20, 2022
1 parent 8331582 commit 1bd1f0b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CodeCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
},
@{
ModuleName = "MSCloudLoginAssistant"
RequiredVersion = "1.0.87"
RequiredVersion = "1.0.101"
},
@{
ModuleName = "PnP.PowerShell"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Unit Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
},
@{
ModuleName = "MSCloudLoginAssistant"
RequiredVersion = "1.0.99"
RequiredVersion = "1.0.101"
},
@{
ModuleName = 'PnP.PowerShell'
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* Ensures all results are returned from the Export scenario. Currently limited at 1,000 results.
FIXES [#2672](https://github.com/microsoft/Microsoft365DSC/issues/2672)
FIXES [#2673](https://github.com/microsoft/Microsoft365DSC/issues/2672)
* EXOManagementRoleAssignment
* Force refresh permissions after the Set-TargetResource is called to ensure the correct cmdlets are loaded in the session.
FIXES [#2523](https://github.com/microsoft/Microsoft365DSC/issues/2523)
* SCSensitivityLabel
* Removed the EncryptionAipTemplateScopes parameter from being evaluated in the Test and removed it from the update scenario in the Set.
FIXES [#2205](https://github.com/microsoft/Microsoft365DSC/issues/2205)
Expand All @@ -21,6 +24,7 @@
FIXES [#2682](https://github.com/microsoft/Microsoft365DSC/issues/2682)
* DEPENDENCIES
* Updated Microsoft.Graph.* to version 1.19.0;
* Updated MSCloudLoginAssistant to version 1.0.101;

# 1.22.1214.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function Set-TargetResource
$ConnectionMode = New-M365DSCConnection -Workload 'ExchangeOnline' `
-InboundParameters $PSBoundParameters

$NewManagementRoleParams = $PSBoundParameters
$NewManagementRoleParams = ([Hashtable]$PSBoundParameters).CLone()
$NewManagementRoleParams.Remove('Ensure') | Out-Null
$NewManagementRoleParams.Remove('Credential') | Out-Null
$NewManagementRoleParams.Remove('ApplicationId') | Out-Null
Expand All @@ -301,7 +301,6 @@ function Set-TargetResource
Write-Verbose -Message "Management Role Assignment'$($Name)' does not exist but it should. Create and configure it."
# Create Management Role
New-ManagementRoleAssignment @NewManagementRoleParams

}
# CASE: Management Role exists but it shouldn't;
elseif ($Ensure -eq 'Absent' -and $currentManagementRoleConfig.Ensure -eq 'Present')
Expand All @@ -323,6 +322,21 @@ function Set-TargetResource
$NewManagementRoleParams.Remove('SecurityGroup') | Out-Null
Set-ManagementRoleAssignment @NewManagementRoleParams
}

# Wait for the permission to be applied
$testResults = $false
$retries = 6
do
{
Start-Sleep -Seconds 10
Write-Verbose -Message "Testing to ensure changes were applied."
$testResults = Test-TargetResource @PSBoundParameters
$retries--
} while (-not $testResults -and $retries -gt 0)

# Need to force reconnect to Exchange for the new permissions to kick in.
Write-Verbose -Message "Disconnecting from Exchange Online"
$Global:MSCloudLoginConnectionProfile.ExchangeOnline.Disconnect()
}

function Test-TargetResource
Expand Down
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Dependencies/Manifest.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
@{
ModuleName = "MSCloudLoginAssistant"
RequiredVersion = "1.0.100"
RequiredVersion = "1.0.101"
},
@{
ModuleName = 'PnP.PowerShell'
Expand Down

0 comments on commit 1bd1f0b

Please sign in to comment.