Skip to content

Commit 3015db0

Browse files
Merge pull request #6507 from microsoft/Dev
Release 1.25.910.1
2 parents 3f8b32d + eaf4552 commit 3015db0

File tree

5 files changed

+129
-14
lines changed

5 files changed

+129
-14
lines changed

CHANGELOG.md

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

3+
# 1.25.910.1
4+
5+
* AADApplication
6+
* Fixed an issue with `AdminConsentGranted` not being correct if the
7+
permissions are from multiple source APIs.
8+
* AADCrossTenantAccessPolicyConfigurationDefault
9+
* Evaluate users and groups by display name to be consistent with
10+
other resources.
11+
312
# 1.25.903.2
413

514
* AADEnrichedAuditLogs

Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ function Get-M365DSCAzureADAppPermissions
19501950
{
19511951
if ($oAuth2grant.Count -gt 0)
19521952
{
1953-
$scopes = $oAuth2grant[0].Scope.Split(' ')
1953+
$scopes = ($oAuth2grant.Scope -join " ").Split(' ')
19541954
if ($scopes.Contains($scopeInfoValue))
19551955
{
19561956
$currentPermission.AdminConsentGranted = $true

Modules/Microsoft365DSC/DSCResources/MSFT_AADCrossTenantAccessPolicyConfigurationDefault/MSFT_AADCrossTenantAccessPolicyConfigurationDefault.psm1

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,42 @@ function Get-TargetResource
108108
Targets = [System.Array] $getValue.B2BCollaborationInbound.UsersAndGroups.Targets
109109
}
110110
}
111+
112+
# Convert users back to UPN
113+
$newValue = @()
114+
foreach ($valueEntry in $B2BCollaborationInboundValue.UsersAndGroups.Targets)
115+
{
116+
$currentEntry = @{
117+
Target = $valueEntry.Target
118+
TargetType = $valueEntry.TargetType
119+
}
120+
if ($valueEntry.TargetType -eq 'user')
121+
{
122+
$user = Get-MgUser -UserId $valueEntry.Target -ErrorAction SilentlyContinue
123+
if ($null -ne $user)
124+
{
125+
$currentEntry.Target = $user.UserPrincipalName
126+
}
127+
else
128+
{
129+
$currentEntry.Target = $valueEntry.Target
130+
}
131+
}
132+
else
133+
{
134+
$group = [System.Array] (Get-MgGroup -GroupId $valueEntry.Target -ErrorAction SilentlyContinue)
135+
if ($null -ne $group -and $group.Length -eq 1)
136+
{
137+
$currentEntry.Target = $group.DisplayName
138+
}
139+
else
140+
{
141+
$currentEntry.Target = $valueEntry.Target
142+
}
143+
}
144+
$newValue += $currentEntry
145+
}
146+
$B2BCollaborationInboundValue.UsersAndGroups.Targets = $newValue
111147
}
112148
if ($null -ne $getValue.B2BCollaborationOutbound)
113149
{
@@ -121,6 +157,42 @@ function Get-TargetResource
121157
Targets = [System.Array] $getValue.B2BCollaborationOutbound.UsersAndGroups.Targets
122158
}
123159
}
160+
161+
# Convert users back to UPN
162+
$newValue = @()
163+
foreach ($valueEntry in $B2BCollaborationOutboundValue.UsersAndGroups.Targets)
164+
{
165+
$currentEntry = @{
166+
Target = $valueEntry.Target
167+
TargetType = $valueEntry.TargetType
168+
}
169+
if ($valueEntry.TargetType -eq 'user')
170+
{
171+
$user = Get-MgUser -UserId $valueEntry.Target -ErrorAction SilentlyContinue
172+
if ($null -ne $user)
173+
{
174+
$currentEntry.Target = $user.UserPrincipalName
175+
}
176+
else
177+
{
178+
$currentEntry.Target = $valueEntry.Target
179+
}
180+
}
181+
else
182+
{
183+
$group = [System.Array] (Get-MgGroup -GroupId $valueEntry.Target -ErrorAction SilentlyContinue)
184+
if ($null -ne $group -and $group.Length -eq 1)
185+
{
186+
$currentEntry.Target = $group.DisplayName
187+
}
188+
else
189+
{
190+
$currentEntry.Target = $valueEntry.Target
191+
}
192+
}
193+
$newValue += $currentEntry
194+
}
195+
$B2BCollaborationOutboundValue.UsersAndGroups.Targets = $newValue
124196
}
125197
if ($null -ne $getValue.B2BDirectConnectInbound)
126198
{
@@ -147,6 +219,41 @@ function Get-TargetResource
147219
Targets = [System.Array] $getValue.B2BDirectConnectOutbound.UsersAndGroups.Targets
148220
}
149221
}
222+
# Convert users back to UPN
223+
$newValue = @()
224+
foreach ($valueEntry in $B2BDirectConnectOutboundValue.UsersAndGroups.Targets)
225+
{
226+
$currentEntry = @{
227+
Target = $valueEntry.Target
228+
TargetType = $valueEntry.TargetType
229+
}
230+
if ($valueEntry.TargetType -eq 'user')
231+
{
232+
$user = Get-MgUser -UserId $valueEntry.Target -ErrorAction SilentlyContinue
233+
if ($null -ne $user)
234+
{
235+
$currentEntry.Target = $user.UserPrincipalName
236+
}
237+
else
238+
{
239+
$currentEntry.Target = $valueEntry.Target
240+
}
241+
}
242+
else
243+
{
244+
$group = [System.Array] (Get-MgGroup -GroupId $valueEntry.Target -ErrorAction SilentlyContinue)
245+
if ($null -ne $group -and $group.Length -eq 1)
246+
{
247+
$currentEntry.Target = $group.DisplayName
248+
}
249+
else
250+
{
251+
$currentEntry.Target = $valueEntry.Target
252+
}
253+
}
254+
$newValue += $currentEntry
255+
}
256+
$B2BDirectConnectOutboundValue.UsersAndGroups.Targets = $newValue
150257
}
151258
if ($null -ne $getValue.InboundTrust)
152259
{
@@ -775,6 +882,8 @@ function Get-M365DSCAADCrossTenantAccessPolicyB2BSetting
775882
$targets = @()
776883
foreach ($currentTarget in $Setting.usersAndGroups.targets)
777884
{
885+
$user = $null
886+
$group = $null
778887
if ($currentTarget.targetType -eq 'User')
779888
{
780889
$user = Get-MgUser -UserId $currentTarget.target -ErrorAction SilentlyContinue

Modules/Microsoft365DSC/Microsoft365DSC.psd1

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 2025-09-05
6+
# Generated on: 2025-09-11
77

88
@{
99

1010
# Script module or binary module file associated with this manifest.
1111
# RootModule = ''
1212

1313
# Version number of this module.
14-
ModuleVersion = '1.25.903.2'
14+
ModuleVersion = '1.25.910.1'
1515

1616
# Supported PSEditions
1717
# CompatiblePSEditions = @()
@@ -151,15 +151,12 @@
151151
IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true'
152152

153153
# ReleaseNotes of this module
154-
ReleaseNotes = '* AADServicePrincipal
155-
* Change in logic to evaluate instances in Test-TargetResource when
156-
multiple instances exist with the same display name.
157-
* IntuneWindowsBackupForOrganizationConfiguration
158-
* Initial release.
159-
* MISC
160-
* Code cleanup across all EXO, Commerce, Defender and Fabric resources.
161-
* DEPENDENCIES
162-
* Update ReverseDSC to version 2.0.0.30.'
154+
ReleaseNotes = '* AADApplication
155+
* Fixed an issue with `AdminConsentGranted` not being correct if the
156+
permissions are from multiple source APIs.
157+
* AADCrossTenantAccessPolicyConfigurationDefault
158+
* Evaluate users and groups by display name to be consistent with
159+
other resources.'
163160

164161
# Flag to indicate whether the module requires explicit user acceptance for install/update
165162
# RequireLicenseAcceptance = $false

Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADCrossTenantAccessPolicyConfigurationDefault.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
100100
UsersAndGroups = (New-CimInstance -ClassName MSFT_AADCrossTenantAccessPolicyTargetConfiguration -Property @{
101101
AccessType = 'allowed'
102102
Targets = [CimInstance[]]@((New-CimInstance -ClassName MSFT_AADCrossTenantAccessPolicyTarget -Property @{
103-
Target = 'AllUsers'
103+
Target = '[email protected]'
104104
TargetType = 'user'
105105
} -ClientOnly))
106106
} -ClientOnly)
@@ -126,7 +126,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
126126
accessType = 'allowed'
127127
targets = @(
128128
@{
129-
target = 'AllUsers'
129+
target = '[email protected]'
130130
targetType = 'user'
131131
}
132132
)

0 commit comments

Comments
 (0)