diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a7de62a68..7082c8eb31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,10 @@ * AADUser * Fixes an issue where provided password wa never honored. FIXES [#2599](https://github.com/microsoft/Microsoft365DSC/issues/2599) + * Added support for the PasswordPolicies property. + FIXES [#2598](https://github.com/microsoft/Microsoft365DSC/issues/2598) * PlannerBucket & PlannerPlan - * Changed invalid permissions in the setting.json files + * Changed invalid permissions in the setting.json files. FIXES [#2629](https://github.com/microsoft/Microsoft365DSC/issues/2629) * TeamsChannel * Fixes an issue where channels weren't created if a non-existing GroupId was specified. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.psm1 index 8265ef20f4..1f0ec55947 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.psm1 @@ -60,6 +60,10 @@ function Get-TargetResource [System.Boolean] $PasswordNeverExpires = $false, + [Parameter()] + [System.String] + $PasswordPolicies, + [Parameter()] [System.String] $PhoneNumber, @@ -163,7 +167,7 @@ function Get-TargetResource try { Write-Verbose -Message "Getting Office 365 User $UserPrincipalName" - $propertiesToRetrieve = @('Id', 'UserPrincipalName', 'DisplayName', 'GivenName', 'Surname', 'UsageLocation', 'City', 'Country', 'Department', 'FacsimileTelephoneNumber', 'Mobile', 'OfficeLocation', 'TelephoneNumber', 'PostalCode', 'PreferredLanguage', 'State', 'StreetAddress', 'JobTitle', 'UserType') + $propertiesToRetrieve = @('Id', 'UserPrincipalName', 'DisplayName', 'GivenName', 'Surname', 'UsageLocation', 'City', 'Country', 'Department', 'FacsimileTelephoneNumber', 'Mobile', 'OfficeLocation', 'TelephoneNumber', 'PostalCode', 'PreferredLanguage', 'State', 'StreetAddress', 'JobTitle', 'UserType', 'PasswordPolicies') $user = Get-MgUser -UserId $UserPrincipalName -Property $propertiesToRetrieve -ErrorAction SilentlyContinue if ($null -eq $user) { @@ -207,6 +211,7 @@ function Get-TargetResource MobilePhone = $user.Mobile Office = $user.OfficeLocation PasswordNeverExpires = $passwordNeverExpires + PasswordPolicies = $user.PasswordPolicies PhoneNumber = $user.TelephoneNumber PostalCode = $user.PostalCode PreferredLanguage = $user.PreferredLanguage @@ -297,6 +302,10 @@ function Set-TargetResource [System.Boolean] $PasswordNeverExpires = $false, + [Parameter()] + [System.String] + $PasswordPolicies, + [Parameter()] [System.String] $PhoneNumber, @@ -619,6 +628,10 @@ function Test-TargetResource [System.Boolean] $PasswordNeverExpires = $false, + [Parameter()] + [System.String] + $PasswordPolicies, + [Parameter()] [System.String] $PhoneNumber, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.schema.mof index 741d9f117f..9dbb1e9cb1 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADUser/MSFT_AADUser.schema.mof @@ -16,6 +16,7 @@ class MSFT_AADUser : OMI_BaseResource [Write, Description("The Mobile Phone Number of the user")] String MobilePhone; [Write, Description("The Office Name of the user")] String Office; [Write, Description("Specifies whether the user password expires periodically. Default value is false")] Boolean PasswordNeverExpires; + [Write, Description("Specifies password policies for the user.")] String PasswordPolicies; [Write, Description("The Phone Number of the user")] String PhoneNumber; [Write, Description("The Postal Code of the user")] String PostalCode; [Write, Description("The Prefered location to store data of the user")] String PreferredDataLocation;