If that doesnt work, then I would use:
Import-Module Microsoft.Graph.Users
$params = @{
passwordProfile = @{
forceChangePasswordNextSignIn = $false
password = "xWwvJ]6NMw+bWH-d"
}
}
Update-MgUser -UserId $userId -BodyParameter $params
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm creating script that get finds wanted service accounts in Azure AD and then changes their password. To find wanted account I'm using following line which works fine
$accounts = Get-MgUser -ConsistencyLevel eventual -Count userCount -Search 'DisplayName:SVC_Acc'
Then I would go to Foreach loop and change all theirs passwords
foreach($account in $accounts) {
$name = $account.DisplayName
$id = $account.Id
Write-Output "Account In Azure AD: $name. Changing the password now..."
}
I have now hard time finding the right command in MgGraph which can change users passwords. All I can find is the old AzureAD module which I would not want to use. So are there MgGraph cmdlet for changing user passwords?
#Set-AzureADUserPassword -ObjectId "$id" -Password $password
If that doesnt work, then I would use:
Import-Module Microsoft.Graph.Users
$params = @{
passwordProfile = @{
forceChangePasswordNextSignIn = $false
password = "xWwvJ]6NMw+bWH-d"
}
}
Update-MgUser -UserId $userId -BodyParameter $params