如何使用 Update-MgUserPassword cmdlet 更改 Entra ID 密码

什么是 Update-MgUserPassword cmdlet?

Update-MgUserPassword 命令用于 Microsoft Graph PowerShell 中更新 Microsoft Entra ID 用户帐户的密码。此 cmdlet 允许用户在无需管理员角色的情况下更新自己的密码。此自助服务功能减少了对 IT 团队的依赖,并通过允许用户独立管理其凭据来增强安全性。

使用 Graph PowerShell 更新 Entra ID 密码

前提条件

在使用 Update-MgUserPassword cmdlet 之前,请确保满足以下先决条件:

  • Verify that the Graph PowerShell module is installed. If not, install it using this script:
    Install-Module Microsoft.Graph -Scope CurrentUser
  • 使用具有更新密码所需权限的帐户连接到 Graph PowerShell。
  • Ensure the signed-in user has the following permissions for self-service password changes:
    • UserAuthenticationMethod.ReadWrite
    • User.ManageIdentities.All(用于管理额外的身份验证因素)

使用 Update-MgUserPassword cmdlet

以下是使用 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 脚本更改 Entra ID 密码的限制

虽然 Graph PowerShell 允许用户使用 Update-MgUserPassword cmdlet 更新自己的密码,但存在一些限制:

  • 使用 Graph PowerShell 更改密码需要脚本知识,这对非技术用户来说可能具有挑战性。
  • Graph PowerShell 缺乏直观的界面,增加了出错的可能性。
  • Graph PowerShell 不要求任何额外的验证方法,可能影响安全性。
  • 没有内置的密码更改报告或审计跟踪功能。

ADManager Plus 是一款具备 Microsoft 365 管理和报告 功能的 IGA 解决方案,帮助管理员克服 Graph PowerShell 的常见限制。通过提供直观的界面、自动化功能和高级报告能力,ADManager Plus 实现了 Entra ID 中高效且简化的用户管理。

使用 ADManager Plus 管理 Entra ID 用户的亮点

  • 与 PowerShell 不同,ADManager Plus 提供图形界面,使帮助台技术人员和管理员更容易管理 Entra ID。
  • ADManager Plus 允许您通过 CSV 导入一次性创建、更新或删除多个 Entra ID 用户。
  • 生成有关用户活动、组成员资格等的详细报告,并实时管理用户。
  • 为关键身份管理任务定义多级审批流程,确保安全。

使用 ADManager Plus 轻松管理 Entra ID 用户

 
  • 什么是 Update-MgUserPassword cmdlet?
  • 使用 Update-MgUserPassword cmdlet 更改 Entra ID 密码
  • 使用 Graph PowerShell 脚本更改 Entra ID 密码的限制
  • 为什么选择 ADManager Plus 管理 Entra ID?
Active Directory管理与报告的一站式解决方案
电子邮件下载链接 Email the ADManager Plus download link