Skip to content

Commit e5d7138

Browse files
committed
Merge remote-tracking branch 'upstream' into Master
2 parents 19323f6 + 598ad60 commit e5d7138

17 files changed

Lines changed: 1092 additions & 314 deletions

File tree

CHANGELOG.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# Change log for Microsoft365DSC
22

3+
# 1.26.211.1
4+
5+
* AADUser
6+
* Fixed an export issue where a user was deleted during a long-running job.
7+
FIXES [#5703](https://github.com/microsoft/Microsoft365DSC/issues/5703)
8+
* IntuneRoleAssignment
9+
* Fixed an issue where properties were omitted during Set and testing
10+
did not work with display names.
11+
FIXES [#6881](https://github.com/microsoft/Microsoft365DSC/issues/6881)
12+
* FabricAdmintenantsettings
13+
* Refreshed the property list.
14+
FIXES [#6866](https://github.com/microsoft/Microsoft365DSC/issues/6866)
15+
* O365OrgSettings
16+
* Changed how errors are handled to fail instead of returning false drifts.
17+
FIXES [#6787](https://github.com/microsoft/Microsoft365DSC/issues/6787)
18+
* O365SearchAndIntelligenceConfiguration
19+
* Expanded try/catch logic to cover all code paths in Get.
20+
FIXES [#6788](https://github.com/microsoft/Microsoft365DSC/issues/6788)
21+
* SPOSearchManagedProperty
22+
* Fixed an issue when connecting to the SPO AdminUrl.
23+
FIXES [#6787](https://github.com/microsoft/Microsoft365DSC/issues/6787)
24+
* TeamsDialInConferencingTenantSettings
25+
* Fixed an issue where the properties `MigrateServiceNumbersOnCrossForestMove`
26+
and `UseUniqueConferenceIds` were not rendered correctly in the
27+
documentation
28+
FIXES [#6890](https://github.com/microsoft/Microsoft365DSC/issues/6890)
29+
* M365DSCUtil
30+
* Fixed an issue during module update where `Install-PSResource` throws
31+
an error if the module was installed in Windows PowerShell but the
32+
update attempt was performed in PowerShell 7.
33+
* Fixed an issue where `Export-M365DSCConfiguration` would stop
34+
exporting resources after an error on Azure DevOps & GitHub.
35+
FIXES [#6862](https://github.com/microsoft/Microsoft365DSC/issues/6862)
36+
* M365DSCPermissions
37+
* Fixed an issue when selecting a property for the result.
38+
FIXES [#6882](https://github.com/microsoft/Microsoft365DSC/issues/6882)
39+
* DEPENDENCIES
40+
* Updated MSCloudLoginAssistant to version 1.1.58.
41+
342
# 1.26.128.1
443

544
* EXOMailboxFolderPermission
@@ -19,6 +58,9 @@
1958
* O365OrgSettings
2059
* Fixed an issue where comparing empty app installation options failed.
2160
FIXES [#6812](https://github.com/microsoft/Microsoft365DSC/issues/6812)
61+
* SCSecurityFilter
62+
* Fixed an issue where connecting to the service was not possible.
63+
FIXES [#6798](https://github.com/microsoft/Microsoft365DSC/issues/6798)
2264
* SPOTenantSettings
2365
* Fixing the empty array casting for AllowSelectSGsInODBListInTenant,
2466
DenySelectSGsInODBListInTenant,DenySelectSecurityGroupsInSPSitesList

Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.psm1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,15 @@ function Get-TargetResource
224224
)
225225
$batchResponse = Invoke-M365DSCGraphBatchRequest -Requests $batchRequests
226226

227+
# If the user was deleted in the meantime, then return an empty hashtable
228+
# This only happens during Export because we cache the user objects
229+
# During normal Get or Test, we would have already returned $nullReturn above
230+
if ($null -ne $Script:exportedInstance -and $batchResponse.status -contains '404')
231+
{
232+
Write-Verbose -Message "The specified user was deleted in the meantime."
233+
return @{}
234+
}
235+
227236
Write-Verbose -Message "Found User $($UserPrincipalName)"
228237
$currentLicenseAssignment = @()
229238
$skus = ($batchResponse | Where-Object -FilterScript { $_.id -eq 'License' }).body.value
@@ -979,6 +988,7 @@ function Export-TargetResource
979988
All = [switch]$true
980989
Property = $Script:propertiesToRetrieve
981990
ErrorAction = 'Stop'
991+
Sort = 'UserPrincipalName'
982992
}
983993
$queryTypes = @{
984994
'eq' = @('assignedPlans/any(a:a/capabilityStatus)',

Modules/Microsoft365DSC/DSCResources/MSFT_FabricAdminTenantSettings/MSFT_FabricAdminTenantSettings.psm1

Lines changed: 562 additions & 8 deletions
Large diffs are not rendered by default.

Modules/Microsoft365DSC/DSCResources/MSFT_FabricAdminTenantSettings/MSFT_FabricAdminTenantSettings.schema.mof

Lines changed: 50 additions & 8 deletions
Large diffs are not rendered by default.

Modules/Microsoft365DSC/DSCResources/MSFT_IntuneRoleAssignment/MSFT_IntuneRoleAssignment.psm1

Lines changed: 79 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -147,19 +147,19 @@ function Get-TargetResource
147147
}
148148
}
149149

150-
$ResourceScopesDisplayNames = @()
151-
foreach ($ResourceScope in $getValue.ResourceScopes)
150+
$resourceScopesDisplayNamesValue = @()
151+
foreach ($resourceScope in $getValue.ResourceScopes)
152152
{
153-
$group = Get-MgGroup -GroupId $ResourceScope -ErrorAction SilentlyContinue
153+
$group = Get-MgGroup -GroupId $resourceScope -ErrorAction SilentlyContinue
154154
if ($null -eq $group)
155155
{
156-
Write-Warning -Message "Could not find group with Id {$ResourceScope} when retrieving resource scope display names"
156+
Write-Warning -Message "Could not find group with Id {$resourceScope} when retrieving resource scope display names"
157157
continue
158158
}
159-
$ResourceScopesDisplayNames += $group.DisplayName
159+
$resourceScopesDisplayNamesValue += $group.DisplayName
160160
}
161161

162-
$MembersDisplayNames = @()
162+
$membersDisplayNamesValue = @()
163163
foreach ($tempMember in $getValue.Members)
164164
{
165165
$group = Get-MgGroup -GroupId $tempMember -ErrorAction SilentlyContinue
@@ -168,7 +168,7 @@ function Get-TargetResource
168168
Write-Warning -Message "Could not find group with Id {$tempMember} when retrieving member display names"
169169
continue
170170
}
171-
$MembersDisplayNames += $group.DisplayName
171+
$membersDisplayNamesValue += $group.DisplayName
172172
}
173173

174174
$scopeTypeValue = $null
@@ -181,10 +181,10 @@ function Get-TargetResource
181181
Description = $getValue.Description
182182
DisplayName = $getValue.DisplayName
183183
ResourceScopes = $getValue.ResourceScopes
184-
ResourceScopesDisplayNames = $ResourceScopesDisplayNames
184+
ResourceScopesDisplayNames = $resourceScopesDisplayNamesValue
185185
ScopeType = $scopeTypeValue
186186
Members = $getValue.Members
187-
MembersDisplayNames = $MembersDisplayNames
187+
MembersDisplayNames = $membersDisplayNamesValue
188188
RoleDefinition = $RoleDefinition
189189
RoleDefinitionDisplayName = $RoleDefinitionDisplayName
190190
Ensure = 'Present'
@@ -308,76 +308,93 @@ function Set-TargetResource
308308

309309
if ($RoleDefinition -notmatch '^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$' -or $RoleDefinition -eq '00000000-0000-0000-0000-000000000000')
310310
{
311-
[string]$roleDefinition = $null
311+
$RoleDefinition = $null
312312
$filter = "DisplayName eq '$($RoleDefinitionDisplayName -replace "'", "''")'"
313313
$roleDefinitionId = Get-MgDeviceManagementRoleDefinition -All -Filter $filter -ErrorAction SilentlyContinue
314314
if ($null -ne $roleDefinitionId)
315315
{
316-
$roleDefinition = $roleDefinitionId.Id
316+
$RoleDefinition = $roleDefinitionId.Id
317317
}
318318
else
319319
{
320320
Write-Verbose -Message "No role definition with DisplayName {$RoleDefinitionDisplayName} was found"
321321
}
322322
}
323323

324-
[array]$members = @()
325-
foreach ($membersDisplayName in $MembersDisplayNames)
324+
[array]$membersValue = @()
325+
if ($PSBoundParameters.ContainsKey('MembersDisplayNames'))
326326
{
327-
$filter = "displayName eq '$($membersDisplayName -replace "'", "''")'"
328-
$memberId = Get-MgGroup -Filter $filter -ErrorAction SilentlyContinue
329-
if ($null -ne $memberId)
327+
foreach ($membersDisplayName in $MembersDisplayNames)
330328
{
331-
if ($members -notcontains $memberId.Id)
329+
$filter = "displayName eq '$($membersDisplayName -replace "'", "''")'"
330+
$memberId = Get-MgGroup -Filter $filter -ErrorAction SilentlyContinue
331+
if ($null -ne $memberId)
332332
{
333-
$members += $memberId.Id
333+
if ($membersValue -notcontains $memberId.Id)
334+
{
335+
$membersValue += $memberId.Id
336+
}
337+
}
338+
else
339+
{
340+
Write-Verbose -Message "No member of type group with DisplayName {$membersDisplayName} was found"
334341
}
335342
}
336-
else
337-
{
338-
Write-Verbose -Message "No member of type group with DisplayName {$membersDisplayName} was found"
339-
}
343+
}
344+
else
345+
{
346+
$membersValue = $Members
340347
}
341348

342-
[array]$resourceScopes = @()
343-
foreach ($resourceScopesDisplayName in $ResourceScopesDisplayNames)
349+
[array]$resourceScopesValue = @()
350+
if ($PSBoundParameters.ContainsKey('ResourceScopesDisplayNames'))
344351
{
345-
$filter = "DisplayName eq '$($resourceScopesDisplayName -replace "'", "''")'"
346-
$resourceScopeId = Get-MgGroup -Filter $filter -ErrorAction SilentlyContinue
347-
if ($null -ne $resourceScopeId)
352+
foreach ($resourceScopesDisplayName in $ResourceScopesDisplayNames)
348353
{
349-
if ($ResourceScopes -notcontains $resourceScopeId.Id)
354+
$filter = "DisplayName eq '$($resourceScopesDisplayName -replace "'", "''")'"
355+
$resourceScopeId = Get-MgGroup -Filter $filter -ErrorAction SilentlyContinue
356+
if ($null -ne $resourceScopeId)
350357
{
351-
$ResourceScopes += $resourceScopeId.Id
358+
if ($resourceScopesValue -notcontains $resourceScopeId.Id)
359+
{
360+
$resourceScopesValue += $resourceScopeId.Id
361+
}
362+
}
363+
else
364+
{
365+
Write-Verbose -Message "No resource scope of type group with DisplayName {$resourceScopesDisplayName} was found"
352366
}
353367
}
354-
else
355-
{
356-
Write-Verbose -Message "No resource scope of type group with DisplayName {$ResourceScopesDisplayName} was found"
357-
}
358368
}
369+
else
370+
{
371+
$resourceScopesValue = $ResourceScopes
372+
}
373+
374+
$scopeTypeValue = $ScopeType
359375
if ($ScopeType -match 'AllDevices|AllLicensedUsers|AllDevicesAndLicensedUsers')
360376
{
361-
$ResourceScopes = $null
377+
$resourceScopesValue = $null
362378
}
363379
else
364380
{
365-
$ScopeType = 'resourceScope'
366-
$ResourceScopes = $resourceScopes
381+
$scopeTypeValue = 'resourceScope'
367382
}
383+
368384
if ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Absent')
369385
{
370386
Write-Verbose -Message "Creating an Intune Role Assignment with DisplayName {$DisplayName}"
371387

372388
$CreateParameters = @{
373389
description = $Description
374390
displayName = $DisplayName
375-
resourceScopes = $ResourceScopes
376-
scopeType = $ScopeType
377-
members = $Members
391+
resourceScopes = $resourceScopesValue
392+
scopeType = $scopeTypeValue
393+
members = $membersValue
378394
'@odata.type' = '#microsoft.graph.deviceAndAppManagementRoleAssignment'
379-
'roleDefinition@odata.bind' = "$((Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl)beta/deviceManagement/roleDefinitions('$roleDefinition')"
395+
'roleDefinition@odata.bind' = "$((Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl)beta/deviceManagement/roleDefinitions('$RoleDefinition')"
380396
}
397+
381398
$null = New-MgBetaDeviceManagementRoleAssignment -BodyParameter $CreateParameters
382399
}
383400
elseif ($Ensure -eq 'Present' -and $currentInstance.Ensure -eq 'Present')
@@ -387,14 +404,15 @@ function Set-TargetResource
387404
$UpdateParameters = @{
388405
description = $Description
389406
displayName = $DisplayName
390-
resourceScopes = $ResourceScopes
391-
scopeType = $ScopeType
392-
members = $Members
407+
resourceScopes = $resourceScopesValue
408+
scopeType = $scopeTypeValue
409+
members = $membersValue
393410
'@odata.type' = '#microsoft.graph.deviceAndAppManagementRoleAssignment'
394-
'roleDefinition@odata.bind' = "$((Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl)beta/deviceManagement/roleDefinitions('$roleDefinition')"
411+
'roleDefinition@odata.bind' = "$((Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl)beta/deviceManagement/roleDefinitions('$RoleDefinition')"
395412
}
396413

397-
Update-MgBetaDeviceManagementRoleAssignment -BodyParameter $UpdateParameters `
414+
$null = Update-MgBetaDeviceManagementRoleAssignment `
415+
-BodyParameter $UpdateParameters `
398416
-DeviceAndAppManagementRoleAssignmentId $currentInstance.Id
399417
}
400418
elseif ($Ensure -eq 'Absent' -and $currentInstance.Ensure -eq 'Present')
@@ -493,57 +511,6 @@ function Test-TargetResource
493511
Add-M365DSCTelemetryEvent -Data $data
494512
#endregion
495513

496-
if (-not ($RoleDefinition -match '^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$'))
497-
{
498-
[string]$roleDefinition = $null
499-
$filter = "displayName eq '$($RoleDefinitionDisplayName -replace "'", "''")'"
500-
$roleDefinitionId = Get-MgDeviceManagementRoleDefinition -All -Filter $filter -ErrorAction SilentlyContinue
501-
if ($null -ne $roleDefinitionId)
502-
{
503-
$roleDefinition = $roleDefinitionId.Id
504-
$PSBoundParameters.RoleDefinition = $roleDefinition
505-
}
506-
else
507-
{
508-
Write-Verbose -Message "No role definition with DisplayName {$RoleDefinitionDisplayName} was found"
509-
}
510-
}
511-
512-
foreach ($membersDisplayName in $MembersDisplayNames)
513-
{
514-
$filter = "DisplayName eq '$($MembersDisplayName -replace "'", "''")'"
515-
$newMember = Get-MgGroup -Filter $filter -ErrorAction SilentlyContinue
516-
if ($null -ne $newMember)
517-
{
518-
if ($Members -notcontains $newMember.Id)
519-
{
520-
$Members += $newMember.Id
521-
}
522-
}
523-
else
524-
{
525-
Write-Verbose -Message "No member of type group with DisplayName {$membersDisplayName} was found"
526-
}
527-
}
528-
$PSBoundParameters.Members = $Members
529-
530-
foreach ($resourceScopesDisplayName in $ResourceScopesDisplayNames)
531-
{
532-
$filter = "displayName eq '$($resourceScopesDisplayName -replace "'", "''")'"
533-
$newResourceScope = Get-MgGroup -Filter $filter -ErrorAction SilentlyContinue
534-
if ($null -ne $newResourceScope)
535-
{
536-
if ($ResourceScopes -notcontains $newResourceScope.Id)
537-
{
538-
$ResourceScopes += $newResourceScope.Id
539-
}
540-
}
541-
else
542-
{
543-
Write-Verbose -Message "No resource scope of type group with DisplayName {$ResourceScopesDisplayName} was found"
544-
}
545-
}
546-
$PSBoundParameters.ResourceScopes = $ResourceScopes
547514

548515
$compareParameters = Get-CompareParameters
549516
$result = Test-M365DSCTargetResource -DesiredValues $PSBoundParameters `
@@ -700,7 +667,22 @@ function Get-CompareParameters
700667
param()
701668

702669
return @{
703-
ExcludedProperties = @('ResourceScopesDisplayNames', 'MembersDisplayNames')
670+
PostProcessing = {
671+
param($DesiredValues, $CurrentValues, $ValuesToCheck, $ignore)
672+
if ($DesiredValues.ContainsKey('MembersDisplayNames'))
673+
{
674+
$ValuesToCheck.Remove('Members') | Out-Null
675+
}
676+
if ($DesiredValues.ContainsKey('ResourceScopesDisplayNames'))
677+
{
678+
$ValuesToCheck.Remove('ResourceScopes') | Out-Null
679+
}
680+
if ($DesiredValues.ContainsKey('RoleDefinitionDisplayName'))
681+
{
682+
$ValuesToCheck.Remove('RoleDefinition') | Out-Null
683+
}
684+
return [System.Tuple[Hashtable, Hashtable, Hashtable]]::new($DesiredValues, $CurrentValues, $ValuesToCheck)
685+
}
704686
}
705687
}
706688

Modules/Microsoft365DSC/DSCResources/MSFT_O365Group/MSFT_O365Group.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function Get-TargetResource
6060
$AccessTokens
6161
)
6262

63-
Write-Verbose -Message "Setting configuration of Office 365 Group $DisplayName"
63+
Write-Verbose -Message "Getting configuration of Office 365 Group $DisplayName"
6464

6565
try
6666
{

0 commit comments

Comments
 (0)