Skip to content

Commit

Permalink
Merge pull request #5656 from NikCharlebois/Various-Fixes
Browse files Browse the repository at this point in the history
Removed dependency on Graph to retrieve user info
  • Loading branch information
NikCharlebois authored Jan 22, 2025
2 parents 2cd3bfe + 9e0d0c1 commit fdfb259
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
FIXES [#5602](https://github.com/microsoft/Microsoft365DSC/issues/5602)
* AADServicePrincipal
* FIXES [#5549](https://github.com/microsoft/Microsoft365DSC/issues/5549)
* EXOAvailabilityConfig
* Removed dependency on Microsoft Graph to retrieve user information.
* EXODistributionGroup
* Removed dependency on Microsoft Graph to retrieve user information.
* EXOHostedContentFilterPolicy
* Use correct parameter `DesiredValues` given to `Test-M365DSCParameterState`,
contrary to `EXOTenantAllowBlockListItems` these resources are not affected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ function Test-TargetResource

Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)"

$testResult = $true
foreach ($reviewer in $Reviewers)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ function Test-TargetResource
Write-Verbose -Message "Testing configuration of the Azure AD Authentication Requirement for a user with UPN {$UserPrincipalName}"

$CurrentValues = Get-TargetResource @PSBoundParameters
$ValuesToCheck = ([Hashtable]$PSBoundParameters).clone()

$ValuesToCheck = ([Hashtable]$PSBoundParameters).Clone()
$testResult = $true

$CurrentValues.remove('Id') | Out-Null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ function Test-TargetResource

Write-Verbose -Message "Current Values: $(Convert-M365DscHashtableToString -Hashtable $CurrentValues)"
Write-Verbose -Message "Target Values: $(Convert-M365DscHashtableToString -Hashtable $ValuesToCheck)"

$testResult = $true

#Compare Cim instances
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ function Export-TargetResource
$j = 1
foreach ($resourceGroup in $resourceGroups)
{
if ($null -ne $Global:M365DSCExportResourceInstancesCount)
{
$Global:M365DSCExportResourceInstancesCount++
}
$displayedKey = $resourceGroup.ResourceGroupName
Write-Host " |---[$j/$($resourceGroups.Length)] $displayedKey" -NoNewline

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ function Get-TargetResource
-InboundParameters $PSBoundParameters
}

$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters

#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

Expand All @@ -83,8 +80,8 @@ function Get-TargetResource

if ($null -ne $AvailabilityConfigs -and $null -ne $AvailabilityConfigs.OrgWideAccount)
{
$user = Get-MgUser -UserId $OrgWideAccount -ErrorAction Stop
$AvailabilityConfig = ($AvailabilityConfigs | Where-Object -FilterScript { $_.OrgWideAccount -IMatch $user.UserId })
$user = Get-User -Identity $OrgWideAccount -ErrorAction Stop
$AvailabilityConfig = ($AvailabilityConfigs | Where-Object -FilterScript { $_.OrgWideAccount -IMatch $user.Id })
}
if ($null -eq $AvailabilityConfig)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function Get-TargetResource
{
try
{
$user = Get-MgUser -UserId $user -ErrorAction Stop
$user = Get-User -Identity $user -ErrorAction Stop
$ManagedByValue += $user.UserPrincipalName
}
catch
Expand All @@ -311,7 +311,7 @@ function Get-TargetResource
{
try
{
$user = Get-MgUser -UserId $user -ErrorAction Stop
$user = Get-User -Identity $user -ErrorAction Stop
$ModeratedByValue += $user.UserPrincipalName
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
}


Mock -CommandName Get-MgUser -MockWith {
Mock -CommandName Get-User -MockWith {
return @{
UserPrincipalName = '[email protected]'
}
Expand Down Expand Up @@ -189,7 +189,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Credential = $Credential
}

Mock -CommandName Get-MgUser -MockWith {
Mock -CommandName Get-User -MockWith {
return @{
UserPrincipalName = '[email protected]'
}
Expand Down Expand Up @@ -250,7 +250,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Credential = $Credential
}

Mock -CommandName Get-MgUser -MockWith {
Mock -CommandName Get-User -MockWith {
return @{
UserPrincipalName = '[email protected]'
}
Expand Down Expand Up @@ -301,7 +301,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture {
Credential = $Credential
}

Mock -CommandName Get-MgUser -MockWith {
Mock -CommandName Get-User -MockWith {
return @{
UserPrincipalName = '[email protected]'
}
Expand Down

0 comments on commit fdfb259

Please sign in to comment.