Skip to content

Commit

Permalink
Merge pull request #5398 from NikCharlebois/Fixes-#5390
Browse files Browse the repository at this point in the history
Fixes #5390
  • Loading branch information
NikCharlebois authored Nov 13, 2024
2 parents eea1412 + a87e0ca commit f21af2d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* Fixed bug where an empty value was passed in the request for the
insiderRiskLevels parameter, which throws an error.
FIXES [#5389](https://github.com/microsoft/Microsoft365DSC/issues/5389)
* Fixes a bug where 3P apps could not be assigned by DisplayName for both
IncludeApplications and ExcludeApplications
FIXES [#5390](https://github.com/microsoft/Microsoft365DSC/issues/5390)
* EXOATPBuiltInProtectionRule, EXOEOPProtectionRule
* Fixed issue where empty arrays were being compared incorrectly to null
strings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,11 +1031,54 @@ function Set-TargetResource
Write-Verbose -Message 'Set-Targetresource: create Application Condition object'
if ($currentParameters.ContainsKey('IncludeApplications'))
{
$conditions.Applications.Add('includeApplications', $IncludeApplications)
$IncludeApplicationsValue = @()
foreach ($app in $IncludeApplications)
{
$ObjectGuid = [System.Guid]::empty
if ([System.Guid]::TryParse($app, [System.Management.Automation.PSReference]$ObjectGuid))
{
$IncludeApplicationsValue += $app
}
else
{
$appInfo = Get-MgApplication -Filter "DisplayName eq '$app'" -ErrorAction SilentlyContinue
if ($null -ne $appInfo)
{
$IncludeApplicationsValue += $appInfo.AppId
}
else
{
$IncludeApplicationsValue += $app
}
}
}

$conditions.Applications.Add('includeApplications', $IncludeApplicationsValue)
}
if ($currentParameters.ContainsKey('excludeApplications'))
{
$conditions.Applications.Add('excludeApplications', $ExcludeApplications)
$ExcludeApplicationsValue = @()
foreach ($app in $ExcludeApplications)
{
$ObjectGuid = [System.Guid]::empty
if ([System.Guid]::TryParse($app, [System.Management.Automation.PSReference]$ObjectGuid))
{
$ExcludeApplicationsValue += $app
}
else
{
$appInfo = Get-MgApplication -Filter "DisplayName eq '$app'" -ErrorAction SilentlyContinue
if ($null -ne $appInfo)
{
$ExcludeApplicationsValue += $appInfo.AppId
}
else
{
$ExcludeApplicationsValue += $app
}
}
}
$conditions.Applications.Add('excludeApplications', $ExcludeApplicationsValue)
}
if ($ApplicationsFilter -and $ApplicationsFilterMode)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Get-TargetResource
[Switch]
$ManagedIdentity
)
Write-Verbose -Message 'Checking the Teams Upgrade Configuration'
Write-Verbose -Message 'Checking the Teams Org Wide App Settings'

$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftTeams' `
-InboundParameters $PSBoundParameters
Expand Down Expand Up @@ -105,7 +105,7 @@ function Set-TargetResource
$ManagedIdentity
)

Write-Verbose -Message 'Setting Teams Upgrade Configuration'
Write-Verbose -Message 'Setting the Teams Org Wide App Settings'

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies
Expand Down Expand Up @@ -169,7 +169,7 @@ function Test-TargetResource
Add-M365DSCTelemetryEvent -Data $data
#endregion

Write-Verbose -Message 'Testing configuration of Team Upgrade Settings'
Write-Verbose -Message 'Testing configuration for the Teams Org Wide App Settings'

$CurrentValues = Get-TargetResource @PSBoundParameters

Expand Down

0 comments on commit f21af2d

Please sign in to comment.