使用 Powershell 以编程方式更改 Azure 密码
Programatically changing an Azure password with Powershell
我目前创建了一些 Azure AD 帐户,这些帐户在自动化等领域与 RBAC 一起使用。
目前更改这些帐户的密码是一个劳动密集型过程。有许多活动部件需要立即更新。以及首先更改密码的手动步骤。
是否可以通过 Powershell 更改 Azure AD 密码。 (理想情况下只使用 Azure Cmdlets)从而使我能够自动化整个过程。
安装 Azure AD PowerShell module 后,您可以 运行 这个:
$msolcred = get-credential
connect-msolservice -credential $msolcred
$user = "usertochange@yourtenant.onmicrosoft.com";
#optionally set password not to expire
Set-MsolUser -UserPrincipalName $user -PasswordNeverExpires $true
$pwd = read-host "Please enter the new AAD user's password:"
MSOnlineExtended\Set-MsolUserPassword -UserPrincipalName $user -NewPassword $pwd -ForceChangePassword $false
我目前创建了一些 Azure AD 帐户,这些帐户在自动化等领域与 RBAC 一起使用。
目前更改这些帐户的密码是一个劳动密集型过程。有许多活动部件需要立即更新。以及首先更改密码的手动步骤。
是否可以通过 Powershell 更改 Azure AD 密码。 (理想情况下只使用 Azure Cmdlets)从而使我能够自动化整个过程。
安装 Azure AD PowerShell module 后,您可以 运行 这个:
$msolcred = get-credential
connect-msolservice -credential $msolcred
$user = "usertochange@yourtenant.onmicrosoft.com";
#optionally set password not to expire
Set-MsolUser -UserPrincipalName $user -PasswordNeverExpires $true
$pwd = read-host "Please enter the new AAD user's password:"
MSOnlineExtended\Set-MsolUserPassword -UserPrincipalName $user -NewPassword $pwd -ForceChangePassword $false