Skip to content

Commit

Permalink
Fix an issue with error handling in Get-TargetResource - implemented …
Browse files Browse the repository at this point in the history
…in IntuneAppConfigurationPolicy
  • Loading branch information
William-Francillette committed Feb 20, 2024
1 parent 4431518 commit d840c16
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 60 deletions.
39 changes: 35 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Change log for Microsoft365DSC
# UNRELEASED

# 1.24.214.3

<<<<<<<<< Temporary merge branch 1
* IntuneAccountProtectionLocalAdministratorPasswordSolutionPolicy
* Added support for assignment GroupDisplayName
* IntuneAccountProtectionLocalUserGroupMembershipPolicy
Expand All @@ -29,7 +27,40 @@
* Added support for assignment GroupDisplayName
* IntuneDeviceCompliancePolicyWindows10
* Added support for assignment GroupDisplayName
=========

# 1.24.214.3

* AADAuthenticationMethodPolicy
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyAuthenticator
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyEmail
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyFido2
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicySms
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicySoftware
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyTemporary
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyVoice
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyX509
* Fixed an error where the Export method would loop through the response header.
* IntuneAppConfigurationPolicy
* Fixed an error in the export on the Settings property.
* IntuneDeviceEnrollmentStatusPageWindows10
* Fixed an error where the Export method would loop through the response header.
* IntuneWindowsAutopilotDeploymentProfileAzureADJoined
* Fixed an error where the Export method would loop through the response header.
* SCDLPComplianceRule
* Fixed the NotifyEmailCustomText and NotifyPolicyTipCustomText to escape fancy
quotes.
* DEPENDENCIES
* Updated Microsoft.Graph to version 2.14.1.

# 1.24.214.2
* AADConditionalAccessPolicy
* Removed invalid empty string value that was added to the validate set
of two parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,60 +626,4 @@ function ConvertTo-M365DSCIntuneAppConfigurationPolicyCustomSettings
Remove-M365DSCAuthenticationParameter
}

function Clear-M365DSCAuthenticationParameter
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$BoundParameters
)

$BoundParameters.Credential = $null
$BoundParameters.ApplicationId = $null
$BoundParameters.ApplicationSecret = $null
$BoundParameters.TenantId = $null
$BoundParameters.CertificatePassword = $null
$BoundParameters.CertificatePath = $null
$BoundParameters.CertificateThumbprint = $null
$BoundParameters.ManagedIdentity = $null

return $BoundParameters
}
function Test-M365DSCAuthenticationParameter
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$BoundParameters
)

$authenticationParameterList = @(
'Credential'
'ApplicationId'
'ApplicationSecret'
'TenantId'
'CertificatePassword'
'CertificatePath'
'CertificateThumbprint'
'ManagedIdentity'
)

$validAuthenticationParameter = $false
foreach ($parameter in $authenticationParameterList)
{
if ($null -ne $BoundParameters.$parameter)
{
write-host ("$parameter is not null" )
$validAuthenticationParameter = $true
break
}
}

return $validAuthenticationParameter
}

Export-ModuleMember -Function *-TargetResource
70 changes: 70 additions & 0 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4403,6 +4403,76 @@ function Remove-M365DSCAuthenticationParameter
return $BoundParameters
}

<#
.Description
This function clears the authentication parameters from the hashtable.
.Functionality
Internal
#>
function Clear-M365DSCAuthenticationParameter
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$BoundParameters
)

$BoundParameters.Credential = $null
$BoundParameters.ApplicationId = $null
$BoundParameters.ApplicationSecret = $null
$BoundParameters.TenantId = $null
$BoundParameters.CertificatePassword = $null
$BoundParameters.CertificatePath = $null
$BoundParameters.CertificateThumbprint = $null
$BoundParameters.ManagedIdentity = $null

return $BoundParameters
}
<#
.Description
This function validate if the authentication parameters from the hashtable have been cleared.
.Functionality
Internal
#>
function Test-M365DSCAuthenticationParameter
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param(
[Parameter(Mandatory = $true)]
[System.Collections.Hashtable]
$BoundParameters
)

$authenticationParameterList = @(
'Credential'
'ApplicationId'
'ApplicationSecret'
'TenantId'
'CertificatePassword'
'CertificatePath'
'CertificateThumbprint'
'ManagedIdentity'
)

$validAuthenticationParameter = $false
foreach ($parameter in $authenticationParameterList)
{
if ($null -ne $BoundParameters.$parameter)
{
write-host ("$parameter is not null" )
$validAuthenticationParameter = $true
break
}
}

return $validAuthenticationParameter
}

<#
.Description
This function analyzes an M365DSC configuration file and returns information about potential issues (e.g., duplicate primary keys).
Expand Down

0 comments on commit d840c16

Please sign in to comment.