We can set an Office 365 user password by using the Azure Active Directory powershell cmdlet Set-MsolUserPassword. To use this cmdlet we need to install Microsoft Online Services Sign-In Assistant and Azure Active Directory Powershell Module.
Note: Before proceed, Install and Configure Azure AD PowerShell
Set-MsolUserPassword –UserPrincipalName [UserPrincipalName] –NewPassword [New Password] -ForceChangePassword $False
The below command set the password for the user “[email protected]”
Set-MsolUserPassword –UserPrincipalName '[email protected]' –NewPassword 'MyPa$w0rd' -ForceChangePassword $False
Advertisement
the password is not open
You can use the “Set-AzureADUserPassword” cmdlet from Azure AD PowerShell V2 module to provide secure string password.
https://learn.microsoft.com/en-us/powershell/module/azuread/set-azureaduserpassword?view=azureadps-2.0