[玩转系统] 如何在 Azure Active Directory (Microsoft 365) 中重置用户密码
作者:精品下载站 日期:2024-12-14 23:23:10 浏览:17 分类:玩电脑
如何在 Azure Active Directory (Microsoft 365) 中重置用户密码
如果 Azure Active Directory 用户忘记了密码,Azure (Microsoft 365) 租户管理员可以通过多种方式重置密码:使用 Azure 门户、通过 PowerShell 或启用自助密码重置 (SSPR) 功能。
要重置用户密码,您的帐户必须具有以下内置 Azure 之一:用户管理员或密码管理员。
在 Azure 门户中重置用户密码
在 Azure 中重置用户密码的最简单方法是使用 Azure 门户 Web 界面(或 Microsoft 365 管理中心):
登录 https://portal.azure.com/ 并转到 Azure Active Directory -> 用户;
选择用户并点击重置密码;
您将收到一条通知,表明将向该用户分配临时密码:
The user '[email protected]' will be assigned a temporary password that must be changed on the next sign in. To display the temporary password, click 'Reset password'.
点击重置密码。
Azure将为用户生成一个新的临时密码并将其显示在屏幕上;
将新密码告诉用户,下次他们使用新式身份验证登录任何 Microsoft 365 应用程序时,系统将提示他们更改密码;
Your need to update your password because this is the first rime you are signing in, or because your password has expired.
您可以使用 Azure 登录日志确保用户已成功进行身份验证。
以下是一些需要记住的重要事项:
临时密码永远不会过期。
-
如果本地 Active Directory 通过 Azure AD 连接器与 Azure 同步,则必须在连接器设置中启用密码写回功能,才能从云重置 ADDS 用户的密码。
您可以在 Azure 租户上启用自助密码重置 (SSPR)。您可以为 Azure Active Directory -> 密码重置 -> 属性中的一组用户或所有 AAD 用户启用 SSPR。
要重置密码,用户可以使用允许的身份验证方法。除了标准 MFA 方法之外,他们还可以使用安全问题和办公室电话。您可以使用一种或两种身份验证方法。
使用 PowerShell 重置 Azure AD 用户密码
通过 Azure 门户重置用户密码时,会自动生成新的临时密码。但是,您可以使用 PowerShell 手动设置新的用户密码。
您还可以通过 Microsoft 365 管理中心手动设置新的用户密码。
您可以使用 Azure AD 模块重置用户的密码。连接到您的 Azure 租户:
Connect-AzureAD
设置新密码并将其转换为 SecureString(请参阅有关如何在 PowerShell 脚本中使用密码的文章):
$newPass = ConvertTo-SecureString 'Str0ngNewPa$$1' -AsPlainText -Force
您可以使用 PowerShell 生成强随机密码:
Add-Type -AssemblyName System.Web
$genpass=[System.Web.Security.Membership]::GeneratePassword(9,2)
$newPass = ConvertTo-SecureString $genpass -AsPlainText -Force
使用 UserPrincipalName 获取要更改密码的用户的对象 ID:
$userObjectId=(Get-AzureADUser -filter "userPrincipalName eq '[email protected]'").ObjectID
通过 ObjectID 将新密码应用到 Azure 用户:
Set-AzureADUserPassword -ObjectId $userObjectId -Password $newPass
如果您希望用户在下次登录时更改密码,请添加
-ForceChangePasswordNextLogin $true
选项。
您将无法查看用户使用 Azure AD PowerShell 模块更改密码的日期和时间。您可以使用 Microsoft Graph API 或旧版 MSOnline 模块获取此信息。
如果您安装了 MSOnline PowerShell 模块,请连接到您的租户:
Connect-MsolService
显示 LastPasswordChangeTimeStamp 值:
Get-MsolUser -UserPrincipalName '[email protected]'| Select DisplayName,UserPrincipalName,LastPasswordChangeTimeStamp
如果在 Azure AD 密码策略中启用了密码过期选项,则可以使用 PowerShell 获取用户密码过期的日期:
$user=Get-MsolUser -UserPrincipalName '[email protected]'
$User.LastPasswordChangeTimestamp.AddDays($PasswordPolicy.ValidityPeriod)
在本地 Active Directory 域服务中,您可以从以下位置获取域用户的密码到期日期:
msDS-UserPasswordExpiryTimeComputed
构造的属性。
或者,您可以从 PowerShell 访问 Microsoft Graph API,以获取更改用户密码的日期和时间以及 Azure 中的用户创建数据:
$ApplicationID = "your-app-ID"
$TenatDomainName = "your-tenant-ID"
$AccessSecret = "your-app-secret"
$Body = @{
Grant_Type = "client_credentials"
Scope = "https://graph.microsoft.com/.default"
client_Id = $ApplicationID
Client_Secret = $AccessSecret
}
$ConnectGraph = Invoke-RestMethod -Uri "https://login.microsoftonline.com/$TenatDomainName/oauth2/v2.0/token" -Method POST -Body $Body
$token = $ConnectGraph.access_token
$GrapUserUrl = 'https://graph.microsoft.com/v1.0/users?$select= userprincipalname,accountenabled,signInActivity,createdDateTime,lastPasswordChangeDateTime'
$users=(Invoke-RestMethod -Headers @{Authorization = "Bearer $($token)"} -Uri $GrapUserUrl -Method Get).value
$users | where userprincipalname -eq '[email protected]' | select userprincipalname,accountenabled,createdDateTime,lastPasswordChangeDateTime
使用 Microsoft Graph API 和 POST 方法,您甚至可以重置用户密码。使用下面的 POST 请求:
POST https://graph.microsoft.com/v1.0/me/changePassword
Content-Type: application/json
{
"currentPassword": "OldPass123!",
"newPassword": "NewP@ss2!"
}
在本文中了解如何在本地 Active Directory 中重置用户密码。
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[短剧合集] 2025年06月2日 精选+付费短剧推荐39部
[软件合集] 25年6月2日 精选软件18个
[软件合集] 25年6月1日 精选软件15个
[短剧合集] 2025年06月1日 精选+付费短剧推荐59部
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[美图] 2W美女个美女小姐姐,饱眼福
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag