microsoftgraph / microsoftgraph/entra-powershell
🪲 Set-EntraUserPasswordProfile always forces password change at next sign-in
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 213
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When changing a user's password using Set-EntraUserPasswordProfile, the forceChangePasswordNextSignIn property is automatically set to true, even if the -ForceChangePasswordNextSignIn parameter is omitted.
The current cmdlet design does not allow users to explicitly specify $true or $false for this parameter (it behaves as a simple switch). As a result, there is no way to update a password via this cmdlet without forcing the user to change it at the next sign-in.
This behavior likely originates from the Microsoft Graph API's default behavior, where omitting the forceChangePasswordNextSignIn property in the request payload defaults it to true.
Reference: Set-EntraUserPasswordProfile
https://learn.microsoft.com/en-us/powershell/module/microsoft.entra.users/set-entrauserpasswordprofile?view=entra-powershell#examples
Reference: passwordProfile resource type
https://learn.microsoft.com/en-us/graph/api/resources/passwordprofile?view=graph-rest-1.0
To Reproduce
Steps to reproduce the behavior:
- Connect to Microsoft Entra
Connect-Entra -Scopes 'Directory.AccessAsUser.All'
- Change a user's password without the force switch
$newPassword = '<strong-password>'
$securePassword = ConvertTo-SecureString $newPassword -AsPlainText -Force
Set-EntraUserPasswordProfile -UserId 'SawyerM@contoso.com' -Password $securePassword
- Verify the property
(Get-EntraUser -UserId 'SawyerM@contoso.com').PasswordProfile.ForceChangePasswordNextSignIn
- Result
The property is set toTrue, despite not being specified in the command.
Expected behavior
One of the following is expected:
- If -ForceChangePasswordNextSignIn is omitted, the value should default to false
Set-EntraUserPasswordProfileshould be updated to accept a boolean value for-ForceChangePasswordNextSignInto allow explicit control.
Current Workaround
We currently have to use Set-EntraUser to explicitly set the value to $false:
Set-EntraUser -UserId '<Object-ID>' -PasswordProfile @{
Password = 'ComplexPassword123!'
ForceChangePasswordNextSignIn = $false
}
Debug Output
⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.
Debug Output
Module Version
# Please paste your result here
Get-InstalledModule -Name Microsoft.Entra
Version Name Repository Description
------- ---- ---------- -----------
1.1.0 Microsoft.Entra PSGallery Microsoft Entra PowerShell v1.0: Microsoft Entra PowerShell ...
Environment Data
# Please paste your result here
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Set-EntraUserPasswordProfile cmdlet entry point and compare its request behavior with the Microsoft Graph passwordProfile documentation linked in the issue. Reproduce the command without -ForceChangePasswordNextSignIn, then verify that omission no longer forces a password change and that the intended explicit behavior remains controllable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100