Skip to content

Commit

Permalink
Fix casing for MustChangePass property
Browse files Browse the repository at this point in the history
  • Loading branch information
kris6673 committed Jan 15, 2025
1 parent 8c42cc3 commit ad28496
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Function Invoke-EditUser {
Write-Host 'PowerShell HTTP trigger function processed a request.'
#Edit the user
try {
Write-Host "$([boolean]$UserObj.mustchangepass)"
Write-Host "$([boolean]$UserObj.MustChangePass)"
$UserPrincipalName = "$($UserObj.Username ? $UserObj.username :$UserObj.mailNickname)@$($UserObj.Domain ? $UserObj.Domain : $UserObj.primDomain.value)"
$BodyToship = [pscustomobject] @{
'givenName' = $UserObj.givenName
Expand Down Expand Up @@ -72,7 +72,7 @@ Function Invoke-EditUser {
$null = $results.Add( 'Success. The user has been edited.' )
Write-LogMessage -API $ApiName -tenant ($UserObj.tenantFilter) -user $User -message "Edited user $($UserObj.DisplayName) with id $($UserObj.id)" -Sev Info
if ($UserObj.password) {
$passwordProfile = [pscustomobject]@{'passwordProfile' = @{ 'password' = $UserObj.password; 'forceChangePasswordNextSignIn' = [boolean]$UserObj.mustchangepass } } | ConvertTo-Json
$passwordProfile = [pscustomobject]@{'passwordProfile' = @{ 'password' = $UserObj.password; 'forceChangePasswordNextSignIn' = [boolean]$UserObj.MustChangePass } } | ConvertTo-Json
$null = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$($UserObj.id)" -tenantid $UserObj.tenantFilter -type PATCH -body $PasswordProfile -verbose
$null = $results.Add("Success. The password has been set to $($UserObj.password)")
Write-LogMessage -API $ApiName -tenant ($UserObj.tenantFilter) -user $User -message "Reset $($UserObj.DisplayName)'s Password" -Sev Info
Expand Down

0 comments on commit ad28496

Please sign in to comment.