Set-EntraUserPasswordProfile
Sets the password of a user.
Syntax
Default (Default)
Set-EntraUserPasswordProfile
[-ForceChangePasswordNextSignIn]
[-ForceChangePasswordNextSignInWithMfa]
-UserId <String>
-Password <SecureString>
[<CommonParameters>]
Description
The Set-EntraUserPasswordProfile cmdlet with alias Set-EntraUserPassword sets the password for a user in Microsoft Entra ID.
Any user can update their password without belonging to any administrator role.
Examples
Example 1: Set a user's password
Connect-Entra -Scopes 'Directory.AccessAsUser.All'
$newPassword = '<strong-password>'
$securePassword = ConvertTo-SecureString $newPassword -AsPlainText -Force
Set-EntraUserPasswordProfile -UserId 'SawyerM@contoso.com' -Password $securePassword
This command sets the specified user's password.
-UserIdparameter specifies the ID of a user in Microsoft Entra ID.-Passwordparameter specifies the password to set.
Example 2: Set a user's password with ForceChangePasswordNextSignInWithMfa parameter
Connect-Entra -Scopes 'Directory.AccessAsUser.All'
$newPassword= '<strong-password>'
$securePassword = ConvertTo-SecureString $newPassword -AsPlainText -Force
Set-EntraUserPasswordProfile -UserId 'SawyerM@contoso.com' -Password $securePassword -ForceChangePasswordNextSignInWithMfa
This command sets the specified user's password with ForceChangePasswordNextSignInWithMfa parameter.
-UserIdparameter specifies the ID of a user in Microsoft Entra ID.-Passwordparameter specifies the password to set.-ForceChangePasswordNextSignInWithMfaparameter force the user to change their password.
Example 3: Set a user's password with ForceChangePasswordNextSignIn parameter
connect-Entra -Scopes 'Directory.AccessAsUser.All'
$newPassword= '<strong-password>'
$securePassword = ConvertTo-SecureString $newPassword -AsPlainText -Force
Set-EntraUserPasswordProfile -UserId 'SawyerM@contoso.com' -Password $securePassword -ForceChangePasswordNextSignIn
This command sets the specified user's password with ForceChangePasswordNextSignIn parameter.
-UserIdparameter specifies the ID of a user in Microsoft Entra ID.-Passwordparameter specifies the password to set.-ForceChangePasswordNextSignInparameter forces a user to change their password during their next log in.
Parameters
-ForceChangePasswordNextSignIn
Forces a user to change their password during their next sign in.
Parameter properties
| Type: | System.Management.Automation.SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-ForceChangePasswordNextSignInWithMfa
If set to true, force the user to change their password.
Parameter properties
| Type: | System.Management.Automation.SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Password
Specifies the password.
Parameter properties
| Type: | System.SecureString |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-UserId
Specifies the ID of a user.
Parameter properties
| Type: | System.String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | ObjectId, UPN, Identity, UserPrincipalName |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.