diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d22e3cbaa..5d755d0134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # UNRELEASED +* AADAdministrativeUnit + * Fix Properties for Dynamic Administrative Units in Graph have moved * AADConditionalAccessPolicy * Fixing issue where the resource crashed when trying to retrieve groups and users from Entra ID which no longer existed diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 index 413dc6b7b7..3440d0cdc3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 @@ -158,17 +158,17 @@ function Get-TargetResource #endregion } - if (-not [string]::IsNullOrEmpty($getValue.AdditionalProperties.membershipType)) + if (-not [string]::IsNullOrEmpty($getValue.membershipType)) { - $results.Add('MembershipType', $getValue.AdditionalProperties.membershipType) + $results.Add('MembershipType', $getValue.membershipType) } - if (-not [string]::IsNullOrEmpty($getValue.AdditionalProperties.membershipRule)) + if (-not [string]::IsNullOrEmpty($getValue.membershipRule)) { - $results.Add('MembershipRule', $getValue.AdditionalProperties.membershipRule) + $results.Add('MembershipRule', $getValue.membershipRule) } - if (-not [string]::IsNullOrEmpty($getValue.AdditionalProperties.membershipRuleProcessingState)) + if (-not [string]::IsNullOrEmpty($getValue.membershipRuleProcessingState)) { - $results.Add('MembershipRuleProcessingState', $getValue.AdditionalProperties.membershipRuleProcessingState) + $results.Add('MembershipRuleProcessingState', $getValue.membershipRuleProcessingState) } Write-Verbose -Message "AU {$DisplayName} MembershipType {$($results.MembershipType)}" diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 index 5fb04e2487..2f72570e31 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 @@ -236,11 +236,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'DSCAU' Id = 'DSCAU' Visibility = 'Public' - AdditionalProperties = @{ - membershipType = 'Assigned' - membershipRule = 'Canada' - membershipRuleProcessingState = 'On' - } + MembershipType = 'Assigned' + MembershipRule = 'Canada' + MembershipRuleProcessingState = 'On' } } @@ -303,9 +301,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Description = 'DSCAU Old Description' DisplayName = 'DSCAU' Id = 'DSCAU' - AdditionalProperties = @{ - membershipType = 'Assigned' - } + MembershipType = 'Assigned' } }