Skip to content

Commit

Permalink
Fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ykuijs committed Jan 14, 2025
1 parent 2c150cf commit 72bc54f
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,26 @@ function Set-TargetResource
Add-M365DSCTelemetryEvent -Data $data
#endregion

try
{
if ($Id)
{
$NamedLocation = Get-MgBetaIdentityConditionalAccessNamedLocation -NamedLocationId $Id -ErrorAction Stop
}
}
catch
{
Write-Verbose -Message "Could not retrieve AAD Named Location by ID {$Id}"
}
if ($null -eq $NamedLocation)
{
$NamedLocation = Get-MgBetaIdentityConditionalAccessNamedLocation -ErrorAction SilentlyContinue | Where-Object -FilterScript { $_.DisplayName -eq $DisplayName }
if ($NamedLocation.Length -gt 1)
{
throw "More than one instance of a Named Location Policy with name {$DisplayName} was found. Please provide the ID parameter."
}
}

$currentAADNamedLocation = Get-TargetResource @PSBoundParameters

$desiredValues = @{
Expand Down

0 comments on commit 72bc54f

Please sign in to comment.