Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikCharlebois committed Dec 8, 2022
1 parent 7ce35f5 commit a927a45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* AADServicePrincipal
* Fixes an issue where the service principals weren't created or updated when using ApplicationSecret to authenticate.
FIXES [#2615](https://github.com/microsoft/Microsoft365DSC/issues/2615)
* AADUser
* Fixes an issue where provided password wa never honored.
FIXES [#2599](https://github.com/microsoft/Microsoft365DSC/issues/2599)
* PlannerBucket & PlannerPlan
* Changed invalid permissions in the setting.json files
FIXES [#2629](https://github.com/microsoft/Microsoft365DSC/issues/2629)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,16 @@ function Set-TargetResource
}
#endregion

$passwordValue = 'TempP@ss'
if ($null -ne $Password)
{
$passwordValue = $Password.GetNetworkCredential().Password
}
$PasswordProfile = @{
Password = $passwordValue
}
$CreationParams.Add('PasswordProfile', $PasswordProfile)

if ($user.UserPrincipalName)
{
Write-Verbose -Message "Updating Office 365 User $UserPrincipalName Information"
Expand All @@ -477,10 +487,6 @@ function Set-TargetResource
{
Write-Verbose -Message "Creating Office 365 User $UserPrincipalName"
$CreationParams.Add('AccountEnabled', $true)
$PasswordProfile = @{
Password = 'TempP@ss'
}
$CreationParams.Add('PasswordProfile', $PasswordProfile)
$CreationParams.Add('MailNickName', $UserPrincipalName.Split('@')[0])
Write-Verbose -Message "Creating new user with values: $(Convert-M365DscHashtableToString -Hashtable $CreationParams)"
$user = New-MgUser @CreationParams
Expand Down

0 comments on commit a927a45

Please sign in to comment.