Skip to content

Commit 559865e

Browse files
authored
Merge branch 'Dev' into Dev
2 parents 82b2d3a + f4fa99b commit 559865e

File tree

521 files changed

+2079
-3322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

521 files changed

+2079
-3322
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
# UNRELEASED
44

5+
* AADNetworkAccessForwardingPolicy
6+
* Fixed an issue where empty `PolicyRules` would throw an exception during Get.
57
* EXOPlace
68
* Fixes an issue with the export where it was trying to export RoomList.
9+
* MISC
10+
* Removed verbose output from `Get-TargetResource`.
11+
* Updated the error behavior to always throw inside `Get-TargetResource`.
712

813
* MSFT_IntuneSettingCatalogCustomPolicyWindows10
914
* Fixed the ability to run Get-TargetResource via the LCM (Get-DscConfiguration) and it's ability to return complex nested objects.

Modules/Microsoft365DSC/DSCResources/MSFT_AADAccessReviewDefinition/MSFT_AADAccessReviewDefinition.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ function Get-TargetResource
450450
-TenantId $TenantId `
451451
-Credential $Credential
452452

453-
return $nullResult
453+
throw
454454
}
455455
}
456456

@@ -1219,15 +1219,13 @@ function Export-TargetResource
12191219
}
12201220
catch
12211221
{
1222-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
1223-
12241222
New-M365DSCLogEntry -Message 'Error during Export:' `
12251223
-Exception $_ `
12261224
-Source $($MyInvocation.MyCommand.Source) `
12271225
-TenantId $TenantId `
12281226
-Credential $Credential
12291227

1230-
return ''
1228+
throw
12311229
}
12321230
}
12331231

Modules/Microsoft365DSC/DSCResources/MSFT_AADAccessReviewPolicy/MSFT_AADAccessReviewPolicy.psm1

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ function Get-TargetResource
4343
$AccessTokens
4444
)
4545

46+
Write-Verbose -Message "Getting configuration of AAD Access Review Policy"
47+
4648
try
4749
{
4850
$null = New-M365DSCConnection -Workload 'MicrosoftGraph' `
@@ -60,12 +62,7 @@ function Get-TargetResource
6062
Add-M365DSCTelemetryEvent -Data $data
6163
#endregion
6264

63-
$nullResult = $PSBoundParameters
64-
$instance = Get-MgBetaPolicyAccessReviewPolicy -ErrorAction SilentlyContinue
65-
if ($null -eq $instance)
66-
{
67-
throw 'Could not retrieve the Access Review Policy'
68-
}
65+
$instance = Get-MgBetaPolicyAccessReviewPolicy -ErrorAction Stop
6966

7067
$results = @{
7168
IsSingleInstance = 'Yes'
@@ -82,14 +79,13 @@ function Get-TargetResource
8279
}
8380
catch
8481
{
85-
Write-Verbose -Message $_
8682
New-M365DSCLogEntry -Message 'Error retrieving data:' `
8783
-Exception $_ `
8884
-Source $($MyInvocation.MyCommand.Source) `
8985
-TenantId $TenantId `
9086
-Credential $Credential
9187

92-
return $nullResult
88+
throw
9389
}
9490
}
9591

@@ -321,15 +317,13 @@ function Export-TargetResource
321317
}
322318
catch
323319
{
324-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
325-
326320
New-M365DSCLogEntry -Message 'Error during Export:' `
327321
-Exception $_ `
328322
-Source $($MyInvocation.MyCommand.Source) `
329323
-TenantId $TenantId `
330324
-Credential $Credential
331325

332-
return ''
326+
throw
333327
}
334328
}
335329

Modules/Microsoft365DSC/DSCResources/MSFT_AADActivityBasedTimeoutPolicy/MSFT_AADActivityBasedTimeoutPolicy.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function Get-TargetResource
131131
-TenantId $TenantId `
132132
-Credential $Credential
133133

134-
return $nullResult
134+
throw
135135
}
136136
}
137137

@@ -504,15 +504,13 @@ function Export-TargetResource
504504
}
505505
catch
506506
{
507-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
508-
509507
New-M365DSCLogEntry -Message 'Error during Export:' `
510508
-Exception $_ `
511509
-Source $($MyInvocation.MyCommand.Source) `
512510
-TenantId $TenantId `
513511
-Credential $Credential
514512

515-
return ''
513+
throw
516514
}
517515
}
518516

Modules/Microsoft365DSC/DSCResources/MSFT_AADAdminConsentRequestPolicy/MSFT_AADAdminConsentRequestPolicy.psm1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,13 @@ function Get-TargetResource
150150
}
151151
catch
152152
{
153-
Write-Verbose -Message $_
154153
New-M365DSCLogEntry -Message 'Error retrieving data:' `
155154
-Exception $_ `
156155
-Source $($MyInvocation.MyCommand.Source) `
157156
-TenantId $TenantId `
158157
-Credential $Credential
159158

160-
return $nullResult
159+
throw
161160
}
162161
}
163162

@@ -483,15 +482,13 @@ function Export-TargetResource
483482
}
484483
catch
485484
{
486-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
487-
488485
New-M365DSCLogEntry -Message 'Error during Export:' `
489486
-Exception $_ `
490487
-Source $($MyInvocation.MyCommand.Source) `
491488
-TenantId $TenantId `
492489
-Credential $Credential
493490

494-
return ''
491+
throw
495492
}
496493
}
497494

Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function Get-TargetResource
282282
-TenantId $TenantId `
283283
-Credential $Credential
284284

285-
return $nullResult
285+
throw
286286
}
287287
}
288288

@@ -1077,15 +1077,13 @@ function Export-TargetResource
10771077
}
10781078
catch
10791079
{
1080-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
1081-
10821080
New-M365DSCLogEntry -Message 'Error during Export:' `
10831081
-Exception $_ `
10841082
-Source $($MyInvocation.MyCommand.Source) `
10851083
-TenantId $TenantId `
10861084
-Credential $Credential
10871085

1088-
return ''
1086+
throw
10891087
}
10901088
}
10911089

Modules/Microsoft365DSC/DSCResources/MSFT_AADAgreement/MSFT_AADAgreement.psm1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function Get-TargetResource
152152
-TenantId $TenantId `
153153
-Credential $Credential
154154

155-
return $nullReturn
155+
throw
156156
}
157157
}
158158

@@ -505,15 +505,13 @@ function Export-TargetResource
505505
}
506506
catch
507507
{
508-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
509-
510508
New-M365DSCLogEntry -Message 'Error during Export:' `
511509
-Exception $_ `
512510
-Source $($MyInvocation.MyCommand.Source) `
513511
-TenantId $TenantId `
514512
-Credential $Credential
515513

516-
return ''
514+
throw
517515
}
518516
}
519517

Modules/Microsoft365DSC/DSCResources/MSFT_AADAppManagementPolicy/MSFT_AADAppManagementPolicy.psm1

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,13 @@ function Get-TargetResource
152152
}
153153
catch
154154
{
155-
Write-Verbose -Message $_
156155
New-M365DSCLogEntry -Message 'Error retrieving data:' `
157156
-Exception $_ `
158157
-Source $($MyInvocation.MyCommand.Source) `
159158
-TenantId $TenantId `
160159
-Credential $Credential
161160

162-
return $nullResult
161+
throw
163162
}
164163
}
165164

@@ -497,15 +496,13 @@ function Export-TargetResource
497496
}
498497
catch
499498
{
500-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
501-
502499
New-M365DSCLogEntry -Message 'Error during Export:' `
503500
-Exception $_ `
504501
-Source $($MyInvocation.MyCommand.Source) `
505502
-TenantId $TenantId `
506503
-Credential $Credential
507504

508-
return ''
505+
throw
509506
}
510507
}
511508

Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -552,20 +552,13 @@ function Get-TargetResource
552552
}
553553
catch
554554
{
555-
if ($Script:ExportMode)
556-
{
557-
throw $_
558-
}
559-
else
560-
{
561-
New-M365DSCLogEntry -Message 'Error retrieving data:' `
562-
-Exception $_ `
563-
-Source $($MyInvocation.MyCommand.Source) `
564-
-TenantId $TenantId `
565-
-Credential $Credential
555+
New-M365DSCLogEntry -Message 'Error retrieving data:' `
556+
-Exception $_ `
557+
-Source $($MyInvocation.MyCommand.Source) `
558+
-TenantId $TenantId `
559+
-Credential $Credential
566560

567-
throw $_
568-
}
561+
throw
569562
}
570563
}
571564

@@ -826,7 +819,7 @@ function Set-TargetResource
826819
else
827820
{
828821
Write-Verbose -Message "Retrieving Scope by Display Name {$($scope.value)}"
829-
822+
830823
$existingScope = $currentAADApp.Api.Oauth2PermissionScopes | Where-Object -FilterScript {$_.Value -eq $scope.value}
831824
$existingScopeId = (New-Guid).ToString()
832825
if ($null -ne $existingScope)
@@ -1907,15 +1900,13 @@ function Export-TargetResource
19071900
}
19081901
catch
19091902
{
1910-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
1911-
19121903
New-M365DSCLogEntry -Message 'Error during Export:' `
19131904
-Exception $_ `
19141905
-Source $($MyInvocation.MyCommand.Source) `
19151906
-TenantId $TenantId `
19161907
-Credential $Credential
19171908

1918-
return ''
1909+
throw
19191910
}
19201911
}
19211912

Modules/Microsoft365DSC/DSCResources/MSFT_AADAttributeSet/MSFT_AADAttributeSet.psm1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function Get-TargetResource
119119
-TenantId $TenantId `
120120
-Credential $Credential
121121

122-
return $nullResult
122+
throw
123123
}
124124
}
125125

@@ -380,18 +380,18 @@ function Export-TargetResource
380380
if ($_.ErrorDetails.Message -like '*Insufficient privileges*')
381381
{
382382
Write-M365DSCHost -Message "`r`n $($Global:M365DSCEmojiYellowCircle) Insufficient permissions or license to export Attribute Sets." -CommitWrite
383+
return ''
383384
}
384385
else
385386
{
386-
Write-M365DSCHost -Message $Global:M365DSCEmojiRedX -CommitWrite
387387
New-M365DSCLogEntry -Message 'Error during Export:' `
388388
-Exception $_ `
389389
-Source $($MyInvocation.MyCommand.Source) `
390390
-TenantId $TenantId `
391391
-Credential $Credential
392-
}
393392

394-
return ''
393+
throw
394+
}
395395
}
396396
}
397397

0 commit comments

Comments
 (0)