Skip to content

Commit

Permalink
Merge pull request #5691 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.25.129.1
  • Loading branch information
NikCharlebois authored Jan 29, 2025
2 parents a7fc257 + a2aaf5d commit a47f605
Show file tree
Hide file tree
Showing 192 changed files with 1,107 additions and 2,002 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change log for Microsoft365DSC

# 1.25.129.1

* AADRoleEligibilityScheduleRequest
* Changed the mapping logic to find Id of a custom role.
* AADServicePrincipal
* Fixes a regression issue when trying to export instances, the authentication
parameters were no longer returned by the Get-TargetResource function.
* IntuneDeviceConfigurationPolicyiOS
* Fixes [#5594] https://github.com/microsoft/Microsoft365DSC/issues/5594
* MISC
* AAD Workload
* Improved performance of various resources during export.

# 1.25.122.2

* AADAdminConsentRequestPolicy
Expand All @@ -10,6 +23,7 @@
* Refactored the export to use a common CIMInstance function.
* AADGroup
* Refactored the export to use a common CIMInstance function.
* Added functionality to add & check on Devices in AAD groups.
* AADHomeRealmDiscoveryPolicy
* Refactored the export to use a common CIMInstance function.
* AADIdentityGovernanceLifecycleWorkflow
Expand Down Expand Up @@ -122,6 +136,11 @@
making the comparison otherwise it may fail as it did for a few resources
FIXES [#5648](https://github.com/microsoft/Microsoft365DSC/issues/5648)
* MISC
* Modified 100+ Test-TargetResource logic to prevent returning $false when
the Ensure parameter doesn't match the desired value. While this could introduce
a very small performance gain in some cases, it resulted in a lot of drifts being
detected without proper logging. All evaluation, including of the Ensure property,
is now being handled by the Test-M365DSCParameterState function.
* Export Performance Improvements
Implements the changes described in [#5615](https://github.com/microsoft/Microsoft365DSC/issues/5615)
Improved resource caching behavior across Intune resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,47 +68,54 @@ function Get-TargetResource

try
{
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion
if (-not $Script:exportedInstance)
{
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters

$nullResult = $PSBoundParameters
$nullResult.Ensure = 'Absent'
#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

$getValue = $null
#region resource generator code
$getValue = Get-MgBetaIdentityGovernanceAccessReviewDefinition -AccessReviewScheduleDefinitionId $Id -ErrorAction SilentlyContinue
#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion

if ($null -eq $getValue)
{
Write-Verbose -Message "Could not find an Azure AD Access Review Definition with Id {$Id}"
$nullResult = $PSBoundParameters
$nullResult.Ensure = 'Absent'

if (-not [System.String]::IsNullOrEmpty($DisplayName))
$getValue = $null
#region resource generator code
$getValue = Get-MgBetaIdentityGovernanceAccessReviewDefinition -AccessReviewScheduleDefinitionId $Id -ErrorAction SilentlyContinue

if ($null -eq $getValue)
{
$getValue = Get-MgBetaIdentityGovernanceAccessReviewDefinition `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript {
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.AccessReviewScheduleDefinition'
Write-Verbose -Message "Could not find an Azure AD Access Review Definition with Id {$Id}"

if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaIdentityGovernanceAccessReviewDefinition `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript {
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.AccessReviewScheduleDefinition'
}
}
}
#endregion
if ($null -eq $getValue)
{
Write-Verbose -Message "Could not find an Azure AD Access Review Definition with DisplayName {$DisplayName}."
return $nullResult
}
}
#endregion
if ($null -eq $getValue)
else
{
Write-Verbose -Message "Could not find an Azure AD Access Review Definition with DisplayName {$DisplayName}."
return $nullResult
$getValue = $Script:exportedInstance
}
$Id = $getValue.Id
Write-Verbose -Message "An Azure AD Access Review Definition with Id {$Id} and DisplayName {$DisplayName} was found"
Expand Down Expand Up @@ -670,12 +677,6 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()

if ($CurrentValues.Ensure -ne $Ensure)
{
Write-Verbose -Message "Test-TargetResource returned $false"
return $false
}
$testResult = $true

#Compare Cim instances
Expand Down Expand Up @@ -820,6 +821,7 @@ function Export-TargetResource
AccessTokens = $AccessTokens
}

$Script:exportedInstance = $config
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,35 @@ function Get-TargetResource
$AccessTokens
)

New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters | Out-Null

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion

$nullResult = $PSBoundParameters
try
{
$instance = Get-MgBetaPolicyAccessReviewPolicy -ErrorAction Stop
if ($null -eq $instance)
if (-not $Script:exportedInstance)
{
New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters | Out-Null

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion

$nullResult = $PSBoundParameters
$instance = Get-MgBetaPolicyAccessReviewPolicy -ErrorAction SilentlyContinue
if ($null -eq $instance)
{
throw 'Could not retrieve the Access Review Policy'
}
}
else
{
throw 'Could not retrieve the Access Review Policy'
$instance = $Script:exportedInstance
}

$results = @{
Expand Down Expand Up @@ -277,7 +284,6 @@ function Export-TargetResource

try
{
$Script:ExportMode = $true
[array] $Script:exportedInstances = Get-MgBetaPolicyAccessReviewPolicy -ErrorAction Stop

$i = 1
Expand Down Expand Up @@ -310,6 +316,7 @@ function Export-TargetResource
AccessTokens = $AccessTokens
}

$Script:exportedInstance = $config
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,39 @@ function Get-TargetResource

try
{
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion
if (-not $Script:exportedInstance)
{
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion

$nullResult = $PSBoundParameters
$nullResult.Ensure = 'Absent'
$nullResult = $PSBoundParameters
$nullResult.Ensure = 'Absent'

$getValue = $null
#region resource generator code
$getValue = Get-MgBetaPolicyActivityBasedTimeoutPolicy -ErrorAction SilentlyContinue
#endregion
if ($null -eq $getValue)
$getValue = $null
#region resource generator code
$getValue = Get-MgBetaPolicyActivityBasedTimeoutPolicy -ErrorAction SilentlyContinue
#endregion
if ($null -eq $getValue)
{
Write-Verbose -Message "Could not find an Azure AD Activity Based Timeout Policy with DisplayName {$DisplayName}"
return $nullResult
}
}
else
{
Write-Verbose -Message "Could not find an Azure AD Activity Based Timeout Policy with DisplayName {$DisplayName}"
return $nullResult
$getValue = $Script:exportedInstance
}
$Id = $getValue.Id
Write-Verbose -Message "An Azure AD Activity Based Timeout Policy with Id {$Id} and DisplayName {$DisplayName} was found."
Expand Down Expand Up @@ -385,12 +392,6 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()

if ($CurrentValues.Ensure -ne $Ensure)
{
Write-Verbose -Message "Test-TargetResource returned $false"
return $false
}
$testResult = $true

#Compare Cim instances
Expand Down Expand Up @@ -531,6 +532,7 @@ function Export-TargetResource
AccessTokens = $AccessTokens
}

$Script:exportedInstance = $config
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,35 @@ function Get-TargetResource
$AccessTokens
)

New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters | Out-Null

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion

$nullResult = $PSBoundParameters
try
{
$instance = Get-MgBetaPolicyAdminConsentRequestPolicy -ErrorAction Stop
if ($null -eq $instance)
if (-not $Script:exportedInstance)
{
New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters | Out-Null

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

#region Telemetry
$ResourceName = $MyInvocation.MyCommand.ModuleName.Replace('MSFT_', '')
$CommandName = $MyInvocation.MyCommand
$data = Format-M365DSCTelemetryParameters -ResourceName $ResourceName `
-CommandName $CommandName `
-Parameters $PSBoundParameters
Add-M365DSCTelemetryEvent -Data $data
#endregion

$nullResult = $PSBoundParameters
$instance = Get-MgBetaPolicyAdminConsentRequestPolicy -ErrorAction SilentlyContinue
if ($null -eq $instance)
{
throw 'Could not retrieve the Admin Consent Request Policy'
}
}
else
{
throw 'Could not retrieve the Admin Consent Request Policy'
$instance = $Script:exportedInstance
}

$reviewersValue = @()
Expand Down Expand Up @@ -431,7 +438,6 @@ function Export-TargetResource

try
{
$Script:ExportMode = $true
[array] $Script:exportedInstances = Get-MgBetaPolicyAdminConsentRequestPolicy -ErrorAction Stop

$i = 1
Expand Down Expand Up @@ -464,6 +470,7 @@ function Export-TargetResource
AccessTokens = $AccessTokens
}

$Script:exportedInstance = $config
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,12 +890,6 @@ function Test-TargetResource

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()

if ($CurrentValues.Ensure -ne $Ensure)
{
Write-Verbose -Message "Test-TargetResource returned $false - Ensure not the same"
return $false
}
$testResult = $true

#Compare Cim instances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ function Set-TargetResource
{
Write-Verbose -Message "Updating for Azure AD Application {$($currentAADApp.DisplayName)} with KeyCredentials:`r`n$($KeyCredentials| Out-String)"

if ((currentAADApp.KeyCredentials.Length -eq 0 -and $KeyCredentials.Length -eq 1) -or (currentAADApp.KeyCredentials.Length -eq 1 -and $KeyCredentials.Length -eq 0))
if (($currentAADApp.KeyCredentials.Length -eq 0 -and $KeyCredentials.Length -eq 1) -or ($currentAADApp.KeyCredentials.Length -eq 1 -and $KeyCredentials.Length -eq 0))
{
Update-MgApplication -ApplicationId $currentAADApp.Id -KeyCredentials $KeyCredentials | Out-Null
}
Expand Down
Loading

0 comments on commit a47f605

Please sign in to comment.