Skip to content

Commit

Permalink
Merge pull request #4332 from NikCharlebois/Release-1.24.214.2
Browse files Browse the repository at this point in the history
Release 1.24.214.2
  • Loading branch information
NikCharlebois authored Feb 15, 2024
2 parents 026919f + f1d585e commit d77368e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change log for Microsoft365DSC

# 1.24.214.1
# 1.24.214.2

* AADConditionalAccessPolicy
* Removed invalid empty string value that was added to the validate set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,12 +806,6 @@ function Test-TargetResource
$ValuesToCheck.Remove('ObjectId') | Out-Null
$ValuesToCheck.Remove('AppId') | Out-Null
$ValuesToCheck.Remove('Permissions') | Out-Null
$ValuesToCheck.Remove('ApplicationId') | Out-Null
$ValuesToCheck.Remove('Credential') | Out-Null
$ValuesToCheck.Remove('TenantId') | Out-Null
$ValuesToCheck.Remove('ApplicationSecret') | Out-Null
$ValuesToCheck.Remove('CertificateThumbprint') | Out-Null
$ValuesToCheck.Remove('ManagedIdentity') | Out-Null

$TestResult = Test-M365DSCParameterState -CurrentValues $CurrentValues `
-Source $($MyInvocation.MyCommand.Source) `
Expand Down
2 changes: 1 addition & 1 deletion Modules/Microsoft365DSC/Microsoft365DSC.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.24.214.1'
ModuleVersion = '1.24.214.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
55 changes: 21 additions & 34 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ function Get-M365DSCTenantNameFromParameterSet
[System.Collections.HashTable]
$ParameterSet
)

if ($ParameterSet.TenantId)
{
return $ParameterSet.TenantId
Expand Down Expand Up @@ -898,47 +897,35 @@ function Test-M365DSCParameterState
$EventMessage = [System.Text.StringBuilder]::New()
$EventMessage.Append("<M365DSCEvent>`r`n") | Out-Null
$TenantName = Get-M365DSCTenantNameFromParameterSet -ParameterSet $DesiredValues
Write-Verbose -Message "Found Tenant Name: $TenantName"
$EventMessage.Append(" <ConfigurationDrift Source=`"$Source`" TenantId=`"$TenantName`">`r`n") | Out-Null

$EventMessage.Append(" <ParametersNotInDesiredState>`r`n") | Out-Null
foreach ($key in $DriftedParameters.Keys)
{
Write-Verbose -Message "Detected Drifted Parameter [$Source]$key"

#region Telemetry
$driftedData = [System.Collections.Generic.Dictionary[[String], [String]]]::new()
$driftedData.Add('Event', 'DriftedParameter')
$driftedData.Add('Parameter', "[$Source]$key")
$driftedData = [System.Collections.Generic.Dictionary[[String], [String]]]::new()
$driftedData.Add('Tenant', $TenantName)
$driftedData.Add('Resource', $source.Split('_')[1])
$driftedData.Add('Event', 'DriftedParameter')

# If custom App Insights is specified, allow for the current and desired values to be captured;
# ISSUE #1222
if ($null -ne $env:M365DSCTelemetryInstrumentationKey -and `
$env:M365DSCTelemetryInstrumentationKey -ne 'bc5aa204-0b1e-4499-a955-d6a639bdb4fa' -and `
$env:M365DSCTelemetryInstrumentationKey -ne 'e670af5d-fd30-4407-a796-8ad30491ea7a')
{
$driftedData.Add('CurrentValue', [string]($CurrentValues[$key]))
$driftedData.Add('DesiredValue', [string]($DesiredValues[$key]))
}
if (-not $Data.ContainsKey('Tenant'))
{
$driftedData.Add('Tenant', $TenantName)
}
$driftedData.Add('Resource', $source.Split('_')[1])
Add-M365DSCTelemetryEvent -Type 'DriftInfo' -Data $driftedData
#endregion
$EventMessage.Append(" <Param Name=`"$key`">" + $DriftedParameters.$key + "</Param>`r`n") | Out-Null
}

#region Telemetry
$TenantName = Get-M365DSCTenantNameFromParameterSet -ParameterSet $DesiredValues
$data.Add('Event', 'ConfigurationDrift')

if (-not $Data.ContainsKey('Tenant'))
# If custom App Insights is specified, allow for the current and desired values to be captured;
# ISSUE #1222
if ($null -ne $env:M365DSCTelemetryInstrumentationKey -and `
$env:M365DSCTelemetryInstrumentationKey -ne 'bc5aa204-0b1e-4499-a955-d6a639bdb4fa' -and `
$env:M365DSCTelemetryInstrumentationKey -ne 'e670af5d-fd30-4407-a796-8ad30491ea7a')
{
$data.Add('Tenant', $TenantName)
$driftedData.Add('CurrentValues', $CurrentValues)
$driftedData.Add('DesiredValues', $DesiredValues)
}
#endregion
$telemetryDriftedParameters = ''
foreach ($key in $DriftedParameters.Keys)
{
Write-Verbose -Message "Detected Drifted Parameter [$Source]$key"
$telemetryDriftedParameters += $key + "`r`n"
$EventMessage.Append(" <Param Name=`"$key`">" + $DriftedParameters.$key + "</Param>`r`n") | Out-Null
}

$driftedData.Add('Parameters', $telemetryDriftedParameters)
Add-M365DSCTelemetryEvent -Type 'DriftInfo' -Data $driftedData
$EventMessage.Append(" </ParametersNotInDesiredState>`r`n") | Out-Null
$EventMessage.Append(" </ConfigurationDrift>`r`n") | Out-Null
$EventMessage.Append(" <DesiredValues>`r`n") | Out-Null
Expand Down

0 comments on commit d77368e

Please sign in to comment.