Skip to content

Commit

Permalink
Merge pull request #4311 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.24.207.2
  • Loading branch information
NikCharlebois committed Feb 9, 2024
2 parents d82db00 + d9216ce commit 14040dc
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 19 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,15 @@
# Change log for Microsoft365DSC

# 1.24.207.2

* TeamsAppSetupPolicy
* Changed the logic to retrieve arrays of Ids in the Get method.
* MISC
* Drift Logging
* Now includes the full list of parameters for the current values.
* Telemetry
* Added a new M365DSCTelemetryEventId parameter to track duplication of events.

# 1.24.207.1

* IntuneDeviceEnrollmentPlatformRestriction
Expand Down
13 changes: 10 additions & 3 deletions Modules/Microsoft365DSC/Microsoft365DSC.psd1
Expand Up @@ -3,15 +3,15 @@
#
# Generated by: Microsoft Corporation
#
# Generated on: 2024-02-07
# Generated on: 2024-02-08

@{

# Script module or binary module file associated with this manifest.
# RootModule = ''

# Version number of this module.
ModuleVersion = '1.24.207.1'
ModuleVersion = '1.24.207.2'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -140,7 +140,14 @@
IconUri = 'https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/Dependencies/Images/Logo.png?raw=true'

# ReleaseNotes of this module
ReleaseNotes = '* IntuneDeviceEnrollmentPlatformRestriction
ReleaseNotes = '* TeamsAppSetupPolicy
* Changed the logic to retrieve arrays of Ids in the Get method.
* MISC
* Drift Logging
* Now includes the full list of parameters for the current values.
* Telemetry
* Added a new M365DSCTelemetryEventId parameter to track duplication of events.
* IntuneDeviceEnrollmentPlatformRestriction
* Added Priority parameter
FIXES [#4081](https://github.com/microsoft/Microsoft365DSC/issues/4081)
* SCDLPComplianceRule
Expand Down
56 changes: 44 additions & 12 deletions Modules/Microsoft365DSC/Modules/M365DSCTelemetryEngine.psm1
Expand Up @@ -5,7 +5,7 @@ This function gets the Application Insights key to be used for storing telemetry
.Functionality
Internal, Hidden
#>
function Get-ApplicationInsightsTelemetryClient
function Get-M365DSCApplicationInsightsTelemetryClient
{
[CmdletBinding()]
param()
Expand Down Expand Up @@ -53,13 +53,12 @@ function Add-M365DSCTelemetryEvent
[System.Collections.Generic.Dictionary[[System.String], [System.Double]]]
$Metrics
)

$TelemetryEnabled = [System.Environment]::GetEnvironmentVariable('M365DSCTelemetryEnabled', `
[System.EnvironmentVariableTarget]::Machine)

if ($null -eq $TelemetryEnabled -or $TelemetryEnabled -eq $true)
{
$TelemetryClient = Get-ApplicationInsightsTelemetryClient
$TelemetryClient = Get-M365DSCApplicationInsightsTelemetryClient

try
{
Expand Down Expand Up @@ -189,27 +188,60 @@ function Add-M365DSCTelemetryEvent
[array]$version = (Get-Module 'Microsoft365DSC').Version | Sort-Object -Descending
$Data.Add('M365DSCVersion', $version[0].ToString())

# Get Dependencies loaded versions
# LCM Metadata Information
try
{
$currentPath = Join-Path -Path $PSScriptRoot -ChildPath '../' -Resolve
$manifest = Import-PowerShellDataFile "$currentPath/Microsoft365DSC.psd1"
$dependencies = $manifest.RequiredModules
$LCMInfo = Get-DscLocalConfigurationManager -ErrorAction Stop

$certificateConfigured = $false
if (-not [System.String]::IsNullOrEmpty($LCMInfo.CertificateID))
{
$certificateConfigured = $true
}

$dependenciesContent = ''
foreach ($dependency in $dependencies)
$partialConfiguration = $false
if (-not [System.String]::IsNullOrEmpty($LCMInfo.PartialConfigurations))
{
$partialConfiguration = $true
}
$Data.Add('LCMUsesPartialConfigurations', $partialConfiguration)
$Data.Add('LCMCertificateConfigured', $certificateConfigured)
$Data.Add('LCMConfigurationMode', $LCMInfo.ConfigurationMode)
$Data.Add('LCMConfigurationModeFrequencyMins', $LCMInfo.ConfigurationModeFrequencyMins)
$Data.Add('LCMRefreshMode', $LCMInfo.RefreshMode)
$Data.Add('LCMState', $LCMInfo.LCMState)
$Data.Add('LCMStateDetail', $LCMInfo.LCMStateDetail)

if ($Global:M365DSCExportInProgress)
{
$Data.Add('M365DSCOperation', 'Export')
}
elseif ($LCMInfo.LCMStateDetail -eq 'LCM is performing a consistency check.')
{
$dependenciesContent += Get-Module $dependency.ModuleName | Out-String
$Data.Add('M365DSCOperation', 'MonitoringScheduled')
}
elseif ($LCMInfo.LCMStateDetail -eq 'LCM is testing node against the configuration.')
{
$Data.Add('M365DSCOperation', 'MonitoringManual')
}
elseif ($LCMInfo.LCMStateDetail -eq 'LCM is applying a new configuration.')
{
$Data.Add('M365DSCOperation', 'ApplyingConfiguration')
}
else
{
$Data.Add('M365DSCOperation', 'Undetermined')
}
$Data.Add('DependenciesVersion', $dependenciesContent)
}
catch
{
Write-Verbose -Message $_
}

$M365DSCTelemetryEventId = (New-GUID).ToString()
$Data.Add('M365DSCTelemetryEventId', $M365DSCTelemetryEventId)

$TelemetryClient.TrackEvent($Type, $Data, $Metrics)
$TelemetryClient.Flush()
}
catch
{
Expand Down
18 changes: 14 additions & 4 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Expand Up @@ -919,6 +919,7 @@ function Test-M365DSCParameterState
}
$TenantName = Get-M365DSCTenantNameFromParameterSet -ParameterSet $DesiredValues
$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
Expand All @@ -943,6 +944,17 @@ function Test-M365DSCParameterState
$EventMessage.Append(" <Param Name =`"$key`">$Value</Param>`r`n") | Out-Null
}
$EventMessage.Append(" </DesiredValues>`r`n") | Out-Null
$EventMessage.Append(" <CurrentValues>`r`n") | Out-Null
foreach ($Key in $CurrentValues.Keys)
{
$Value = $CurrentValues.$Key
if ([System.String]::IsNullOrEmpty($Value))
{
$Value = "`$null"
}
$EventMessage.Append(" <Param Name =`"$key`">$Value</Param>`r`n") | Out-Null
}
$EventMessage.Append(" </CurrentValues>`r`n") | Out-Null
$EventMessage.Append('</M365DSCEvent>') | Out-Null

Add-M365DSCEvent -Message $EventMessage.ToString() -EventType 'Drift' -EntryType 'Warning' `
Expand Down Expand Up @@ -970,9 +982,6 @@ function Test-M365DSCParameterState
-EventID 2 -Source $Source
}

#region Telemetry
Add-M365DSCTelemetryEvent -Data $data
#endregion
return $returnValue
}

Expand Down Expand Up @@ -1164,7 +1173,7 @@ function Export-M365DSCConfiguration
[Switch]
$Validate
)

$Global:M365DSCExportInProgress = $true
$Global:MaximumFunctionCount = 32767

# Define the exported resource instances' names Global variable
Expand Down Expand Up @@ -1348,6 +1357,7 @@ function Export-M365DSCConfiguration

# Clear the exported resource instances' names Global variable
$Global:M365DSCExportedResourceInstancesNames = $null
$Global:M365DSCExportInProgress = $false
}

$Script:M365DSCDependenciesValidated = $false
Expand Down

0 comments on commit 14040dc

Please sign in to comment.