diff --git a/CHANGELOG.md b/CHANGELOG.md index 05509b1cd1..c17670a961 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ # UNRELEASED +* AADNamedLocationPolicy + * Set default value for CountryLookupMethod and removed unwanted properties + FIXES [#3656](https://github.com/microsoft/Microsoft365DSC/issues/3656) * DEPENDENCIES * Updated ExchangeOnlineManagement to version 3.3.0. * Updated Microsoft.Graph modules to version 2.5.0. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 index b09ad605c4..db7ec61077 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.psm1 @@ -193,7 +193,7 @@ function Set-TargetResource [Parameter()] [System.String] [ValidateSet('clientIpAddress','authenticatorAppGps')] - $CountryLookupMethod, + $CountryLookupMethod = 'clientIpAddress', [Parameter()] [System.Boolean] @@ -248,10 +248,10 @@ function Set-TargetResource $desiredValues = @{ '@odata.type' = $OdataType displayName = $DisplayName - isTrusted = $IsTrusted } if ($OdataType -eq '#microsoft.graph.ipNamedLocation') { + $desiredValues.Add('isTrusted', $IsTrusted) $IpRangesValue = @() foreach ($IpRange in $IpRanges) { @@ -291,8 +291,7 @@ function Set-TargetResource } # Named Location should exist and will be configured to desired state elseif ($Ensure -eq 'Present' -and $CurrentAADNamedLocation.Ensure -eq 'Present') - { - $desiredValues.Add('NamedLocationId', $currentAADNamedLocation.Id) | Out-Null + { $VerboseAttributes = ($desiredValues | Out-String) Write-Verbose -Message "Updating existing AAD Named Location {$Displayname)} with attributes: $VerboseAttributes" diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.schema.mof index 529ceee96e..285218272e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADNamedLocationPolicy/MSFT_AADNamedLocationPolicy.schema.mof @@ -5,7 +5,7 @@ class MSFT_AADNamedLocationPolicy : OMI_BaseResource [Write, Description("Specifies the ID of a Named Location in Azure Active Directory.")] String Id; [Key, Description("Specifies the Display Name of a Named Location in Azure Active Directory")] string DisplayName; [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 isTrusted value for the Named Location (IP ranges only) 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;