Skip to content

Commit

Permalink
Merge pull request #4349 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.24.214.3
  • Loading branch information
NikCharlebois authored Feb 20, 2024
2 parents 4fac2e3 + 07305a5 commit 5b558a4
Show file tree
Hide file tree
Showing 18 changed files with 254 additions and 203 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Change log for Microsoft365DSC

# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ function Export-TargetResource
{
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicy `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.DisplayName}
#endregion

$i = 1
Expand All @@ -574,111 +574,112 @@ function Export-TargetResource
if (-not [String]::IsNullOrEmpty($config.displayName))
{
$displayedKey = $config.displayName
}
Write-Host " |---[$i/$($getValue.Count)] $displayedKey" -NoNewline
$params = @{
Id = $config.Id
DisplayName = $config.DisplayName
Ensure = 'Present'
Credential = $Credential
ApplicationId = $ApplicationId
TenantId = $TenantId
ApplicationSecret = $ApplicationSecret
CertificateThumbprint = $CertificateThumbprint
Managedidentity = $ManagedIdentity.IsPresent
}

$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
if ($null -ne $Results.RegistrationEnforcement)
{
$complexMapping = @(
@{
Name = 'RegistrationEnforcement'
CimInstanceName = 'MicrosoftGraphRegistrationEnforcement'
IsRequired = $False
}
@{
Name = 'AuthenticationMethodsRegistrationCampaign'
CimInstanceName = 'MicrosoftGraphAuthenticationMethodsRegistrationCampaign'
IsRequired = $False
}
@{
Name = 'ExcludeTargets'
CimInstanceName = 'MicrosoftGraphExcludeTarget'
IsRequired = $False
}
@{
Name = 'IncludeTargets'
CimInstanceName = 'MicrosoftGraphAuthenticationMethodsRegistrationCampaignIncludeTarget'
IsRequired = $False
}
)
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString `
-ComplexObject $Results.RegistrationEnforcement `
-CIMInstanceName 'MicrosoftGraphregistrationEnforcement' `
-ComplexTypeMapping $complexMapping
Write-Host " |---[$i/$($getValue.Count)] $displayedKey" -NoNewline
$params = @{
Id = $config.Id
DisplayName = $config.DisplayName
Ensure = 'Present'
Credential = $Credential
ApplicationId = $ApplicationId
TenantId = $TenantId
ApplicationSecret = $ApplicationSecret
CertificateThumbprint = $CertificateThumbprint
Managedidentity = $ManagedIdentity.IsPresent
}

if (-Not [String]::IsNullOrWhiteSpace($complexTypeStringResult))
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
if ($null -ne $Results.RegistrationEnforcement)
{
$Results.RegistrationEnforcement = $complexTypeStringResult
$complexMapping = @(
@{
Name = 'RegistrationEnforcement'
CimInstanceName = 'MicrosoftGraphRegistrationEnforcement'
IsRequired = $False
}
@{
Name = 'AuthenticationMethodsRegistrationCampaign'
CimInstanceName = 'MicrosoftGraphAuthenticationMethodsRegistrationCampaign'
IsRequired = $False
}
@{
Name = 'ExcludeTargets'
CimInstanceName = 'MicrosoftGraphExcludeTarget'
IsRequired = $False
}
@{
Name = 'IncludeTargets'
CimInstanceName = 'MicrosoftGraphAuthenticationMethodsRegistrationCampaignIncludeTarget'
IsRequired = $False
}
)
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString `
-ComplexObject $Results.RegistrationEnforcement `
-CIMInstanceName 'MicrosoftGraphregistrationEnforcement' `
-ComplexTypeMapping $complexMapping

if (-Not [String]::IsNullOrWhiteSpace($complexTypeStringResult))
{
$Results.RegistrationEnforcement = $complexTypeStringResult
}
else
{
$Results.Remove('RegistrationEnforcement') | Out-Null
}
}
else
if ($null -ne $Results.SystemCredentialPreferences)
{
$Results.Remove('RegistrationEnforcement') | Out-Null
}
}
if ($null -ne $Results.SystemCredentialPreferences)
{
$complexMapping = @(
@{
Name = 'SystemCredentialPreferences'
CimInstanceName = 'MicrosoftGraphSystemCredentialPreferences'
IsRequired = $False
$complexMapping = @(
@{
Name = 'SystemCredentialPreferences'
CimInstanceName = 'MicrosoftGraphSystemCredentialPreferences'
IsRequired = $False
}
@{
Name = 'ExcludeTargets'
CimInstanceName = 'AADAuthenticationMethodPolicyExcludeTarget'
IsRequired = $False
}
@{
Name = 'IncludeTargets'
CimInstanceName = 'AADAuthenticationMethodPolicyIncludeTarget'
IsRequired = $False
}
)
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString `
-ComplexObject $Results.SystemCredentialPreferences `
-CIMInstanceName 'MicrosoftGraphsystemCredentialPreferences' `
-ComplexTypeMapping $complexMapping

if (-Not [String]::IsNullOrWhiteSpace($complexTypeStringResult))
{
$Results.SystemCredentialPreferences = $complexTypeStringResult
}
@{
Name = 'ExcludeTargets'
CimInstanceName = 'AADAuthenticationMethodPolicyExcludeTarget'
IsRequired = $False
else
{
$Results.Remove('SystemCredentialPreferences') | Out-Null
}
@{
Name = 'IncludeTargets'
CimInstanceName = 'AADAuthenticationMethodPolicyIncludeTarget'
IsRequired = $False
}
)
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString `
-ComplexObject $Results.SystemCredentialPreferences `
-CIMInstanceName 'MicrosoftGraphsystemCredentialPreferences' `
-ComplexTypeMapping $complexMapping
}

if (-Not [String]::IsNullOrWhiteSpace($complexTypeStringResult))
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-Credential $Credential
if ($Results.RegistrationEnforcement)
{
$Results.SystemCredentialPreferences = $complexTypeStringResult
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "RegistrationEnforcement" -isCIMArray:$False
}
else
if ($Results.SystemCredentialPreferences)
{
$Results.Remove('SystemCredentialPreferences') | Out-Null
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "SystemCredentialPreferences" -isCIMArray:$False
}
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
}

$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-Credential $Credential
if ($Results.RegistrationEnforcement)
{
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "RegistrationEnforcement" -isCIMArray:$False
}
if ($Results.SystemCredentialPreferences)
{
$currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "SystemCredentialPreferences" -isCIMArray:$False
}
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
$i++
Write-Host $Global:M365DSCEmojiGreenCheckMark
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId MicrosoftAuthenticator `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId Email `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId Fido2 `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId sms `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId SoftwareOath `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId TemporaryAccessPass `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId Voice `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ function Export-TargetResource
#region resource generator code
[array]$getValue = Get-MgBetaPolicyAuthenticationMethodPolicyAuthenticationMethodConfiguration `
-AuthenticationMethodConfigurationId X509Certificate `
-ErrorAction Stop
-ErrorAction Stop | Where-Object -FilterScript {$null -ne $_.Id}
#endregion

$i = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ function Get-M365DSCIntuneAppConfigurationPolicyCustomSettingsAsString
[OutputType([System.String])]
param(
[Parameter(Mandatory = $true)]
[System.Collections.ArrayList]
[System.Object[]]
$Settings
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ function Get-TargetResource

$getValue = $null
#region resource generator code
$getValue = Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -DeviceEnrollmentConfigurationId $Id -ErrorAction SilentlyContinue
$getValue = Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -DeviceEnrollmentConfigurationId $Id -ErrorAction SilentlyContinue `
| Where-Object -FilterScript {$null -ne $_.DisplayName}

if ($null -eq $getValue)
{
Expand All @@ -139,7 +140,7 @@ function Get-TargetResource
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration' `
}
} | Where-Object -FilterScript {$null -ne $_.DisplayName}
}
}
#endregion
Expand All @@ -149,7 +150,7 @@ function Get-TargetResource
return $nullResult
}

if($getValue -is [Array])
if($getValue -is [Array] -and $getValue.Length -gt 1)
{
Throw "The DisplayName {$DisplayName} returned multiple policies, make sure DisplayName is unique."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function Get-TargetResource

$getValue = $null
#region resource generator code
$getValue = Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -WindowsAutopilotDeploymentProfileId $Id -ErrorAction SilentlyContinue
$getValue = Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -WindowsAutopilotDeploymentProfileId $Id -ErrorAction SilentlyContinue `
| Where-Object -FilterScript {$null -ne $_.DisplayName}

if ($null -eq $getValue)
{
Expand All @@ -117,7 +118,8 @@ function Get-TargetResource
{
$getValue = Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
-ErrorAction SilentlyContinue `
| Where-Object -FilterScript {$null -ne $_.DisplayName}
}
}
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ function Get-TargetResource
GenerateIncidentReport = $PolicyRule.GenerateIncidentReport
IncidentReportContent = $ArrayIncidentReportContent
NotifyAllowOverride = $NotifyAllowOverrideValue
NotifyEmailCustomText = $PolicyRule.NotifyEmailCustomText
NotifyPolicyTipCustomText = $PolicyRule.NotifyPolicyTipCustomText
NotifyEmailCustomText = [regex]::Replace($PolicyRule.NotifyEmailCustomText, $fancyDoubleQuotes, "`"")
NotifyPolicyTipCustomText = [regex]::Replace($PolicyRule.NotifyPolicyTipCustomText, $fancyDoubleQuotes, "`"")
NotifyUser = $PolicyRule.NotifyUser
ReportSeverityLevel = $PolicyRule.ReportSeverityLevel
RuleErrorAction = $PolicyRule.RuleErrorAction
Expand Down
Loading

0 comments on commit 5b558a4

Please sign in to comment.