powershell - 如何重置 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
解决方案
你可以试试下面的命令。
Set-AzureADUserPassword -ObjectId <ObjectId> -Password <Password>
请参阅链接。
更新:
可能是你的SecureString
格式造成的,密码必须满足租户的密码复杂度要求。请参阅Azure AD 中的密码策略。您可以参考我的具体命令,它工作正常。
$Password = ConvertTo-SecureString -String "P@ssW0rD!" -Force –AsPlainText
Set-AzureADUserPassword -ObjectId "ce336193xxxxxxxx" -Password $Password
尝试使用新密码登录 azure 门户,它工作正常。
此外,我想您发布的命令的错误也可能是由它引起的,您可以检查一下。
推荐阅读
- java - 如何使用只有 32 个字符的 SHA-256 对字符串进行哈希处理?
- reactjs - 在 ReactMarkDown 中渲染 JSX
- django - Django MultipleObjectsReturned at /author/Ed Sheeran get() 返回了不止一首歌曲——它返回了 2
- django - 如何衡量视频聊天应用程序的使用情况?
- php - 当 .env 文件中存在变量时,什么可能导致 getenv 失败?
- python - Selenium/Pickle add_cookie 绕过双重身份验证器
- android - 我要求每 3 小时后重新启动我的应用程序
- c# - 跳过订阅处理程序添加的第一个数组的方式
- python - 在没有 numpy 的 Python 中使用嵌套数组和 for 循环运行平均值
- c# - Service Bus Trigger - Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string '' is missing or empty