Update-MgUserPassword 命令用于 Microsoft Graph PowerShell 中更新 Microsoft Entra ID 用户帐户的密码。此 cmdlet 允许用户在无需管理员角色的情况下更新自己的密码。此自助服务功能减少了对 IT 团队的依赖,并通过允许用户独立管理其凭据来增强安全性。
在使用 Update-MgUserPassword cmdlet 之前,请确保满足以下先决条件:
Install-Module Microsoft.Graph -Scope CurrentUser
以下是使用 Update-MgUserPassword cmdlet 更改 Entra ID 密码的方法:
Update-MgUserPassword
-UserId <String>
[-ResponseHeadersVariable <String>]
[-AdditionalProperties <Hashtable>]
[-CurrentPassword <String>]
[-NewPassword <String>]
[-Headers <IDictionary>]
[-PassThru]
[-ProgressAction <ActionPreference>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
$params = @{
currentPassword = "ryTG67@3rygjh"
newPassword = "j739YteRpo#7789"
}
Update-MgUserPassword -UserId $userId -BodyParameter $params
下表列出了一些可与 Update-MgUserPassword cmdlet 一起使用的参数:
| 参数 | 描述 |
|---|---|
| -CurrentPassword | 此参数允许您指定现有密码以进行验证。 |
| -NewPassword | 此参数允许您指定要设置的新密码。 |
| -UserId | 此参数允许您指定用户 ID,例如 UserPrincipalName、对象 ID 或其他标识符。 |
| -Confirm | 此参数在执行 cmdlet 前请求确认。 |
虽然 Graph PowerShell 允许用户使用 Update-MgUserPassword cmdlet 更新自己的密码,但存在一些限制:
ADManager Plus 是一款具备 Microsoft 365 管理和报告 功能的 IGA 解决方案,帮助管理员克服 Graph PowerShell 的常见限制。通过提供直观的界面、自动化功能和高级报告能力,ADManager Plus 实现了 Entra ID 中高效且简化的用户管理。