首页 > 解决方案 > 如何重置 Azure AD 帐户的密码

问题描述

我正在尝试通过 Set-AzureRMADUser cmdlet 重置一个 Azure AD 帐户的密码,但它会抛出错误“Set-AzureRmADUser : Property passwordProfile.password is invalid”。你能检查一下吗?下面是代码。

Set-AzureRmADUser -UserPrincipalName XXXX -Password (ConvertTo-SecureString -String "XXXXX" -Force –AsPlainText)

以下是完整的错误。

Set-AzureRmADUser : Property passwordProfile.password is invalid.
At line:1 char:1
+ Set-AzureRmADUser -UserPrincipalName admin@mit1openlinkcloud.onmicros        ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Update-AzureRmADUser], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.UpdateAzureADUserCommand

标签: powershellazure

解决方案


你可以试试下面的命令。

Set-AzureADUserPassword -ObjectId <ObjectId> -Password <Password>

请参阅链接

更新

可能是你的SecureString格式造成的,密码必须满足租户的密码复杂度要求。请参阅Azure AD 中的密码策略。您可以参考我的具体命令,它工作正常。

$Password = ConvertTo-SecureString -String "P@ssW0rD!" -Force –AsPlainText
Set-AzureADUserPassword -ObjectId "ce336193xxxxxxxx" -Password $Password

在此处输入图像描述

尝试使用新密码登录 azure 门户,它工作正常。

在此处输入图像描述

此外,我想您发布的命令的错误也可能是由它引起的,您可以检查一下。


推荐阅读