Skip to content

Commit

Permalink
Merge pull request #3376 from NikCharlebois/AADNamedLocationPolicy-ad…
Browse files Browse the repository at this point in the history
…ded-CountryLookupMethod

Aad named location policy added country lookup method
  • Loading branch information
ykuijs authored Jun 12, 2023
2 parents a435635 + 15d46fd commit 12fef7c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# UNRELEASED

* AADNamedLocationPolicy
* Added support forthe CountryLookupMethod property
FIXES [#3345](https://github.com/microsoft/Microsoft365DSC/issues/3345)
* DEPENDENCIES
* Updated Microsoft.Graph dependencies to version 1.28.0.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ function Get-TargetResource
[System.String[]]
$CountriesAndRegions,

[Parameter()]
[System.String]
[ValidateSet('clientIpAddress','authenticatorAppGps')]
$CountryLookupMethod,

[Parameter()]
[System.Boolean]
$IncludeUnknownCountriesAndRegions,
Expand Down Expand Up @@ -129,6 +134,7 @@ function Get-TargetResource
IpRanges = $NamedLocation.AdditionalProperties.ipRanges.cidrAddress
IsTrusted = $NamedLocation.AdditionalProperties.isTrusted
CountriesAndRegions = [String[]]$NamedLocation.AdditionalProperties.countriesAndRegions
CountryLookupMethod = $NamedLocation.AdditionalProperties.countryLookupMethod
IncludeUnknownCountriesAndRegions = $NamedLocation.AdditionalProperties.includeUnknownCountriesAndRegions
Ensure = 'Present'
ApplicationSecret = $ApplicationSecret
Expand Down Expand Up @@ -185,6 +191,11 @@ function Set-TargetResource
[System.String[]]
$CountriesAndRegions,

[Parameter()]
[System.String]
[ValidateSet('clientIpAddress','authenticatorAppGps')]
$CountryLookupMethod,

[Parameter()]
[System.Boolean]
$IncludeUnknownCountriesAndRegions,
Expand Down Expand Up @@ -264,6 +275,7 @@ function Set-TargetResource
{
$desiredValues.Add('includeUnknownCountriesAndRegions', $IncludeUnknownCountriesAndRegions)
$desiredValues.Add('countriesAndRegions', $CountriesAndRegions)
$desiredValues.Add('countryLookupMethod', $CountryLookupMethod)
}

# Named Location should exist but it doesn't
Expand Down Expand Up @@ -333,6 +345,11 @@ function Test-TargetResource
[System.String[]]
$CountriesAndRegions,

[Parameter()]
[System.String]
[ValidateSet('clientIpAddress','authenticatorAppGps')]
$CountryLookupMethod,

[Parameter()]
[System.Boolean]
$IncludeUnknownCountriesAndRegions,
Expand Down Expand Up @@ -459,7 +476,6 @@ function Export-TargetResource

try
{

$AADNamedLocations = Get-MgIdentityConditionalAccessNamedLocation -Filter $Filter -All:$true -ErrorAction Stop
if ($AADNamedLocations.Length -eq 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class MSFT_AADNamedLocationPolicy : OMI_BaseResource
[Write, Description("Specifies the IP ranges of the Named Location in Azure Active Directory")] String IpRanges[];
[Write, Description("Specifies the isTrusted value for the Named Location in Azure Active Directory")] Boolean IsTrusted;
[Write, Description("Specifies the countries and regions for the Named Location in Azure Active Directory")] String CountriesAndRegions[];
[Write, Description("Determines what method is used to decide which country the user is located in. Possible values are clientIpAddress(default) and authenticatorAppGps."), ValueMap{"clientIpAddress","authenticatorAppGps"}, Values{"clientIpAddress","authenticatorAppGps"}] String CountryLookupMethod;
[Write, Description("Specifies the includeUnknownCountriesAndRegions value for the Named Location in Azure Active Directory")] Boolean IncludeUnknownCountriesAndRegions;
[Write, Description("Specify if the Azure AD Named Location should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Credentials for the Microsoft Graph delegated permissions."), EmbeddedInstance("MSFT_Credential")] string Credential;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ function Get-TargetResource
$CertificatePassword
)


Write-Verbose -Message "Getting configuration of SCProtectionAlert for $Name"

if ($Global:CurrentModeIsExport)
Expand Down

0 comments on commit 12fef7c

Please sign in to comment.