Reset lots of Azure AD passwords in a flash!

Hi dee hi campers! Just a quickie here… you might be doing a migration, or perhaps it’s the CEO breathing down your neck after a breach demanding you reset the password for a list of users!

Whichever it is, you can whip out this script and impress! 🤣🤣🤣

Make sure you’ve installed AzureAD cmdlets using Install-Module AzureAD -Force.

# set user passwords from a list of UPNs in a csv file with header 'userupns'
$csvfile = "c:\temp\userlist.csv"
$tenant = ""
$newpassword = "NewPassingwording!!!"

Disconnect-AzureAD -Confirm:$false
Connect-AzureAd -tenant $tenant

$csv = Import-Csv $csvfile

$usernames = $csv.userupns

foreach ( $usr in $usernames ) {
$secPassword = ConvertTo-SecureString $newPassword -AsPlainText -Force
Set-AzureADUserPassword -ObjectId $usr -Password $secPassword

# end

Hei Konei Rā !! 🍻🍷🍻🍷🍻


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top